|
But for windows client applications which needs to go into desktops of the masses, I guess people would still prefer using the RAD tools of the past.
I dont think its justified to download a 20mb runtime for a program that has a couple of dialogs. Probably thats one of the reasons we havent seen some cool products (something popular like winzip or a messenger).
- Kannan
|
|
|
|
|
Ok here is the scenario. I have an automated process manager that I am running, it is polling using the timer class every 10 minutes to see if something needs to be run.
If the window is FormWindowState.Normal the memory is between 11 - 21 meg which is fine, when I minimize the window it drops memory useage to around 600k, which is great.
However if I try to run GC after a poll and successful process run, the memory doesn't seem to get collected no matter what I try. I would expect memory to realease to at least 3 - 4 meg once the process is completed however when I call GC this doesnt happen, if I manually minimize the display the memory releases down to 600 - 800k. So I dont think I have references in place that should be there, its almost like GC doesnt fire until I minimize.
Any thoughts?
|
|
|
|
|
One other quick question is there an event that fires when FormWindowState property is changed? I cant find one in documentation but wanted to make sure I wasnt overlooking anything.
|
|
|
|
|
well you cant really force the GC to run your just asking it to.
implement the dispose method on those references and set them to null so you can force the release.
make sure no other object holds a reference to it or it will not release. Much like the old com refernece counter.
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Hello !
is there an efficient way to trim a byte[] to a new size?
i need this for a socket.receive:
byte[] data = new byte[1024]; //Input-Buffer
int recv = s.ReceiveFrom(data,ref sender);
i tried this:
byte[] trimmedData = new byte[recv];
for (int i = 0;i
|
|
|
|
|
The best way to do this is to use a vector<byte> and then you can just use resize().
[edit]
Whoops. Thought I was in the C++ forum. Sorry
[/edit]
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
I read the first line and thought," WHOA, we can do vectors in C# ??? ".
God, I pity me! - Phoncible P. Bone
If I end up Windows ME someone is going to be hurting. - One of the answers to a question for What OS are you
|
|
|
|
|
lol
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
byte[] trimmedData = new byte[recv];
Array.Copy(data, 0, trimmedData, 0, trimmedData.Length );
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
hi
i wanna ask about how can i control the connection of the internet of a pc within lan(lased line)
i mean how can i pause and restore the connection again in this pc
HINT: again the connect isn't dial up connection
it is lased line and all computers connected by network and the
connection of the internet within this lased line
thank you and i hope u can help me
Ahmed Mazrou3
|
|
|
|
|
your going to need to use the wininet.dll to control internetconnect and few other functions from that library
http://www.c-sharpcorner.com/vbnet/vbcode/CallingWinInetVK.asp
This shows some examples
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Here's my class...
using System;
using System.Windows.Forms;
namespace GPG__
{
public class logging
{
LOG logForm=new LOG();
aOut caller=new aOut();
Form1 guiForm=new Form1();
int k;
public logging(string [] aLog, string start, string end, string duration, int delay, string file)
{
logForm.Show();
logForm.listBoxLog.Items.Add(DateTime.Now.ToString("hh:mm:ss")+": Processing: "+file);
<big> if(guiForm.checkBoxEnableDelay.Checked==true)
{
MessageBox.Show("CHECKED");
logForm.listBoxLog.Items.Add(DateTime.Now.ToString("hh:mm:ss")+": Delay "+delay.ToString());
}
else
{
MessageBox.Show("NOT CHECKED");
}</big>
for (k=1; k<aLog.Length; k++)
logForm.listBoxLog.Items.Add(DateTime.Now.ToString("hh:mm:ss")+": ["+aLog[k].ToString()+"]");
}
}
}
Now, look at the if statment asking if checkBoxEnableDelay is checked...
When ever I run this, it always evaluates to false, and the else stament runs... and yes, the box IS checked...
If I put the same code on my main FORM it runs fine...
WHat is the problem?
p.s. (ignore the broken for statment at the bottom... it's not like that in my code..._)
/\ |_ E X E GG
|
|
|
|
|
hmm... I think it has somthing to do with if the check box is checked at form load, or not...
cause if I set the checkbox to checked in the PROPERTY EXPLORER, the if statment elvaluates to true. But if I un check it in the RUNNING FORM, it still evaluates to true...
and it's the same vice versa... if I uncheck it in the PROPERTY EXPLORER, it will elvauate to false, even if I CHECK it in the running FORM...
any ideas?
/\ |_ E X E GG
|
|
|
|
|
it's because you are declaring a " new " instance of Form1
eggie5 wrote:
Form1 guiForm=new Form1();
Form1 guiForm=new Form1();
..............................
why not add the checkbox to the logging sub, eg:
public logging(string [] aLog, string start, string end, string duration, int delay, string file,CheckBox cb)<br />
if(cb.Checked==true)<br />
|
|
|
|
|
Thank you thank you.
your are a good man.
/\ |_ E X E GG
|
|
|
|
|
Thanks for taking time to respond to my question. I'm going over a threading sample from MSDN and is having a hard time trying to understand the sample:
(a) Monitor.Wait
(b) Monitor.Pulse
(c) waiting Vs ready queue in context of threading
(d) Why you need to add a "readerFlag" in the resource you are acquiring a lock on when you have already locked the resource using "lock( )" statement.
Before going further, reference to MSDN here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkthreadingtutorial.asp
QUESTION 1:
"A lot of times there are a couple of steps to locking an object"
>> Q1-a: I don't get it. To lock and unlock an object:
Monitor.Enter(thisObj); //This won't return until you get the lock
thisObj.DoSomething();
Monitor.Exit(thisObj);
To try to lock and obj, use Monitor.TryEnter instead. But, in our MSDN sample:
public void WriteToCell(int n)
{
lock(this) // Enter synchronization block: The "lock()" block.
{
if (readerFlag)
{ // Why do you need this flag if you have already "lock" the resource???
}
} // Q1-b: Lock release here - my understanding correct?? This means you can do whatever you want in the "lock" block.? (Exiting THE "lock()"-block)
}
}
>> Q1-c: Once you acquire the lock (via Monitor.Enter or lock() function as in sample), NO other thread can acquire lock on "thisObj" until "Monitor.Exit". There's NO need for "readerFlag".
QUESTION 2:
Quote:
"Now that the cook is done, you go "hey over there, it's my turn! No one else is allowed to cut in front of me!" so you call
[
Monitor.Wait(this);
]"
>> Q2-a: Doesn't Wait function surrender lock to resource to next thread in "waiting queue". According to MSDN, Wait() does this:
* "Releases the lock on an object in order to permit other threads (in waiting queue) to lock and access the object."
* "Releases the lock on an object and blocks the current thread until it reacquires the lock."
My question is, why release lock BEFORE you actually do something (Read) with reseource?
public int ReadFromCell( )
{
lock(this) // Enter synchronization block: The "lock()"-block
{
if (!readerFlag) //WhY?? You ALREADY have the lock on "this" resource.
{
try
{
// Again, WHY!? You ALREADY have lock on "this" resource.
Monitor.Wait(this);
}
... catch statements...
}
Console.WriteLine("Consume: {0}",cellContents); //Q2-b: NOW you're reading - but why can't you read immediately after "lock(this)" statement???
readerFlag = false; // Q2-c: I have no idea why we need this flag.
// is done.
Monitor.Pulse(this); // Q2-d: I have no idea why we need to pulse - exitining the "lock()" block surrender the lock, other threads waiting for the resources will naturally be able to acquire it once execution exit the "lock()" block, why Pulse???
} // Exit synchronization block: The "lock()"-block
return cellContents;
}
>> Q2-f: waiting queue Vs ready queue - What the... It's in Monitor class documentation (.NET framework).
Help!
|
|
|
|
|
|
Well explained, let me go back and see if I truely understand it. Thanks.
norm
|
|
|
|
|
Thanks a lot, gone thru the sample today.
norm
|
|
|
|
|
When I developing my webservice can I edit WSDL file? I can't find this file in the folder of XML application.It create in my consumer application when I addd reference to it, so does this file create on the server?
Mazy
No sig. available now.
|
|
|
|
|
The WSDL is generated by passing a parameter to the webservice's .asmx file.
For the CP webservice (http://www.codeproject.com/webservices/latest.asmx) the WSDL is at: http://www.codeproject.com/webservices/latest.asmx?WSDL
Mazdak wrote:
When I developing my webservice can I edit WSDL file?
I don't think so, I think .NET always generates the WSDL file based on what the webservice offers.
James
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Do a search for the wsdl file
or using the .net prompt type
wsdl /language:CS /out:<filename>.cs <webservicename>.wsdl
this creates your wsdl file or just do a serach for *.wsdl
its an xml file so you can easily edit it in vs, notepad, xml spy or whatever although I dont know of any valid reason to.
you can do it throuogh the IDE and then just edit it there
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Thanks for reply james.
Ista wrote:
you can do it throuogh the IDE and then just edit it there
But where can I save it? When user request it how can I force VS.NET use my wsdl, not create its own version?
Mazy
No sig. available now.
|
|
|
|
|
Its created based on your asmx file. What exactly are you trying to do so I can fully understand why you are trying to change it.
You might want to change the web service attributes in your class inorder to change that file. Because it is created based on your your web attributes and what not. Are you trying to build custom wsdl by client or what?
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Hello all
I'm trying to create a logon web application and would like to check the validity of a new user's email address...
apart from string searching for '@' and '.' etc
I would like to check that the server exists and that there is an account for the new user (maybe use a ping somehow)
Thanks a lot
gil s
|
|
|
|