|
Good to see you again, professor
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I want to write C# application that will log on to web page with provided user name and password.
Any hint on this!
Thanks,
Perry
|
|
|
|
|
Then you need to keep the session identity from one request to the next. Get the cookies collection from each response and use in the next request that you make.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi
the following code reduce my available memory
and increase my Application memory usage up to 300MB
(when it repeat each 200 times)
what can i do ?
tanks in advance
public static void ResetLocalDB()
{
using (SqlDataAdapter Adapter = new SqlDataAdapter("select * from LocalDB", LocalConnection))
{
Adapter.Fill(LocalDataSet, "LocalDB");
}
}
|
|
|
|
|
reza assar wrote: the following code reduce my available memory
Running ANY code will do this. Why is it a problem? 300MB is not a lot of memory to use.
reza assar wrote: (when it repeat each 200 times)
So don't do it 200 times
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Garbage collection doesn't happen immediately. When it does the amount of allocated memory your application is using will decrease. Because allocating/returning memory from/to the OS is a relatively expensive process, your app won't do so immediately. Eventually if you don't use it the memory manager will decide ti doesn't need that much and return it. If your OS is getting low on memory it will ask if your app can return some and it will do so then, if your OS was low on memory when this was going on you'd've had a GC collect during the middle of your memory hogging exercise and the peak would never have gotten that high. There're some system events that will do the same (minimizing is one of them).
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Are absolutely sure that it reduces the available memory, or are you just looking in the Task Manager at how much memory the memory management system has allocated?
It's normal for an application to allocate memory that you use, and not release it until it is actually needed for something else.
Do you dispose the database connection correctly?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi
at first thanks for your attention
yes i looked at task manager
but it wont release my ram memory until i close the application
it wont release even when i dispose my object explicitly
please explain me more about that
do you mean that i have not to be worry about that 300MB of ram ?
it`s so expensive !!!!
|
|
|
|
|
reza assar wrote: yes i looked at task manager
but it wont release my ram memory until i close the application
What you see in the task manager is how much memory the memory manager has allocated, not how much memory is actually used.
reza assar wrote: it wont release even when i dispose my object explicitly
You should always dispose objects that are disposable. That's how you control the life cycle of the object. Disposing objects however doesn't mean that their memory is reclaimed, that is done by the garbage collector when it's convenient or when it's needed.
If the garbage collector would reclaim the memory for every single object that is released, your program would run much slower. To free a few bytes the garbage collector would have to move several megabytes around in memory just to align the objects continuously in memory.
reza assar wrote: do you mean that i have not to be worry about that 300MB of ram ?
it`s so expensive !!!!
You don't have to worry. Unless you have done something wrong, the memory will be reclaimed if it's needed. If you minimise the program you should see how it reacts when the system tells it to make an effort to release memory.
The way that the .NET framework handles memory seems expensive only as you are focusing on the amount of memory allocated. A computer doesn't run better if it has a lot of unused memory. On the contrary, it would be more expensive to move the objects around in memory all the time so that you could release every single byte of unused memory to the system, only to make it look better in the task manager.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
reza assar wrote: my Application memory usage up to 300MB
That's not out of the ordinary
reza assar wrote: select * from LocalDB
Is it necessary for your program to be fetching all fields from all records in the LocalDB table?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
hi
at first thanks for your attention
i want to have changes in my DbGrid immediately do you offer a god way
it wont release my ram memory until i close the application
it wont release even when i dispose my object explicitly
please explain me more about that
do you mean that i have not to be worry about that 300MB of ram ?
it`s so expensive !!!!
|
|
|
|
|
reza assar wrote: do you mean that i have not to be worry about that 300MB of ram ?
No worries about the actual ram. If the system runs out, then it'll go to virtual memory on the hard drive. As slow as that is, it's better than nothing.
Take a closer look at the requirements of your program and see where you can trim out unneeded data ( such as fields you are not working with)...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
hi,
i have question i need to check from exchange server which message was read last time by user, and i wonder how can i check it programmitcaly using c# and mapi33 library, this infromation is in some tag's?
thanks a lot
|
|
|
|
|
Bitmap bm = new Bitmap(@"C:\LEGO.jpg");
Graphics gr = Graphics.FromImage(bm);
gr.DrawEllipse(Pens.AliceBlue, new Rectangle(5, 5, 50, 50));
gr.Dispose();
bm.Save(@"C:\LEGO.jpg");
Error:
System.Runtime.InteropServices.ExternalException was unhandled
A generic error occurred in GDI+.
I know the loaded bitmap file is still locked and there will be no error if saved with a different name, but I want to apply my changes to the same file, is it doable?? How??
Many thanks!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
You can save it with different name, delete old one and rename the one you created.
|
|
|
|
|
You can user the "Clone()" function to get a new bitmap object and dispose the original one.
some thing like:
Bitmap bm = new Bitmap(@"C:\LEGO.jpg");
Bitmap tmp = bm.Clone();
bm.Dispose();
Graphics gr = Graphics.FromImage(tmp);
gr.DrawEllipse(Pens.AliceBlue, new Rectangle(5, 5, 50, 50));
gr.Dispose();
tmp.Save(@"C:\LEGO.jpg");
hope this helps.
regards
|
|
|
|
|
Open a file stream and read the image from the stream. That way you can close the stream so the file is not locked.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanx Guffa! It works now
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Guffa was correct. The problem is that your first line of code, Bitmap(@"C:\LEGO.jpg"); , is locking, by design if the Image class Bitmap derives from, the file it loaded for the lifetime of the Bitmap object. So, to get around this limitation, you have to read the .jpg file yourself using a StreamReader, then create the Bitmap from the StreamReader object. This will prevent the file from being locked so you can Save the new image file over the old one without getting that error.
|
|
|
|
|
Thanx Dave, but did you actually try this solution?? Does it work with you?? How can you do it with stream reader?? Did you mean FileStream?? And if so, it still doesnt work even after closing it!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Sorry, using a FileStream works. Yes, I have done it and, yes, it does work. There's something else you're doing, or not doing correctly that's keeping the file locked. See this[^].
|
|
|
|
|
|
Hi
Is there any tools in visual Studio 2008 Team Suite for Team Working (Like Visual Source Safe) ?
if so, can any one give me a useful article for working with it ?
thanks
|
|
|
|
|
Team Foundation Server (TFS) is the source control & bug tracking server from MS, I can't remember if it comes with Visual studio team suite or if you have to buy it separately (Probably depends on if you have an MSDN license or not).
There are other non-ms alternatives to source safe too. Just google for source control. (Subversion, Perforce, CVS, Git are just a few)
(Comparisom of source control software[^])
If you need bug/issue tracking as well, there are also plenty of options (Bugzilla, BugTracker.net, FogBugz, Trac are a few I can think of). (Comparisom of bug tracking software[^])
Simon
|
|
|
|
|
Thanks Simon
can i use Source Safe for Visual Studio 2008, Instead of TFS ?
|
|
|
|