|
In the mean time I have read a dozen articles on the subject.
This is my conclusion:
1) objects smaller than 80KB will pose no problems if handled correctly.
2) objects larger than 80KB are allocated in LOH (Large Object Heap) which is
susceptible to fragmentation since there is no compaction for it; there are some
guidelines to reduce the likelyhood (i.e. postpone the unfortunate situation), see e.g.
Nish's article[^].
My advice is avoid unnecessary large objects (i.e. >80KB), so don't turn an image
into a byte[] or a string that exceeds that threshold.
BTW In software hope and pray is not a viable strategy.
|
|
|
|
|
Luc Pattyn wrote: BTW In software hope and pray is not a viable strategy
I've been looking for a signature for ages! Hope you don't mind
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
|
I forgot to mention:
multithreading, i.e. having multiple threads that generate images out of XML is a
very bad idea as long as your generation process produces large objects that
are permanent (the images themselves), AND large objects that are not permanent
(the base64 strings and the byte arrays).
So you really should:
- either have simple code, with large objects, and a single thread;
- or elaborate code, avoiding all intermediate large objects, and only then is
multithreading a good idea.
|
|
|
|
|
Justin Time wrote: mImage = new Bitmap(stream);
So what happens to the previous Bitmap instance? You need to dispose of it, if you can.
|
|
|
|
|
It is already being disposed before hand.
|
|
|
|
|
Hi All...can any1 tell me if there is a way to disable or hide all the IE7's menubars and statusbars and how can i how do i do it?
Thnks in advance
living life on the flip side
|
|
|
|
|
You can use the javascript method window.open to open a browser window, and the options you pass to it define what is visible in the browser window.
|
|
|
|
|
Hi Pete...thnks for the reply but i dont understand....wat options do i define....menubar.visible = "False" or how will i do it?
i dont no the options in other words!
living life on the flip side
|
|
|
|
|
Kiosk mode[^]?
Or write an app whose only control is a WebBrowser?
|
|
|
|
|
say there's a server program lauch in a LAN network and it is listening at port number 2000.
1. Anyone has an idea on how to obtained the ip address for the above mentioned server?
2. Or is it possible to communicate to this port with the condition that ip address for the above server was not given. Hacker pls help
|
|
|
|
|
You definately need the IP (or hostname) of the server in order to connect to it. That would be like someone sending you an email without your email address! If you don't know the IP you could do an ip scan on your network to find any ip's with port 2000 open.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
1. You must find it manually. It likes "find house number 2000", but in which city ? which street ?
2. Read first, how TCPIP works. You cannot connect to server if you don't know the IP address.
|
|
|
|
|
You asked this question yesterday and got the same answers.
You can't do it. You only option is to enumerate all the IP address on the network and ping them to test if the port is open.
As several people have said, it's like asking where to find house number 103 but without telling them which road it's on.
Simon
|
|
|
|
|
again,
1) you need to know the server ip in order to connect to it.
2) do you want to know if it´s possible for you as a client to connect to a server without giving your ip? no
When the designed application on the server asks the client´s ip when he tries to connect, if the server can´t get it, he doesn´t grant acess to the client. i woulnd´t!!!
Do you want to make a fake ip, be somewhat stealth mode? is that it? i don´t how to do that but, i think you can find something of that to download.
|
|
|
|
|
simple solution would be ...search the IP with in the LAN and match its port number.
Sr. Software Engineer
Irevna, India
|
|
|
|
|
scan the your Lan ip's using dos command " net view" it would give all machine names and then from that machine names get their corresponding ip's.
then combine ipaddress and the port u want to scan, thru this code
for (int CurrPort = 1; CurrPort <= 25; CurrPort++)
{
TcpClient TcpScan = new TcpClient();
try
{
// Try to connect
TcpScan.Connect("192.168.0.1", CurrPort);
// If there's no exception, we can say the port is open
MessageBox.Show("Port " + CurrPort + " open");
}
catch
{
// An exception occured, thus the port is probably closed
MessageBox.Show("Port " + CurrPort + " closed");
}
}
|
|
|
|
|
Hi,
I am trying to run the following code in a dynamically loaded WCF service hosted in a Windows Service.
It seems I can't load types because of the following exception:
Could not load file or assembly 'APLUGINASSEMBLY, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ddd7975916a1e051' or one of its dependencies. The system cannot find the file specified.
Here is the list of the referenced assemblies:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089Viveo.Data, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ddd7975916a1e051
NavigationProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullSystem.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Please note that the very same code works fine when I run the WCF Service from Visual Studio.
Thanks.
protected static void AnalysePlugins(Assembly[] Assemblies)
{
foreach (Assembly anAssembly in Assemblies)
{
try
{
foreach (Type aType in anAssembly.GetExportedTypes())
{
try
{
if (aType.GetInterface("ANINTERFACE") != null)
{
string theNavigationName = (string)aType.InvokeMember("Name", BindingFlags.GetProperty, null, aType.GetConstructor(new Type[]{}).Invoke(new object[]{}), null);
NavigationRepository[theNavigationName] = aType;
PluginRepository[aType] = anAssembly;
}
}
catch(Exception ex)
{
Trace.WriteLine(aType + " could not have its name queried");
}
}
}
catch (Exception ex)
{
System.Diagnostics.EventLog.WriteEntry("BusinessServer", ex.Message);
System.Diagnostics.EventLog.WriteEntry("BusinessServer", string.Concat(anAssembly.GetReferencedAssemblies()));
}
}
}
|
|
|
|
|
I found out!
It works when I load the assemblies using LoadFrom instead of LoadFile (it is in a function that I have not provided).
|
|
|
|
|
In my project there is a facility for user to upload images and update them later.A visitor to the site can view the users images.What I want to do is that I want to display all the images with equal dimensions.That means if the user uploads image of any size it should be displayed say as 100 X 100 without change in its quality(Resolution, aspect ratio etc.)
Any help would be highly appreciated.Thanks
|
|
|
|
|
Well, you may use GDI+ for the purpose. Look also at very nice Libor Tinka's article [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello,
I am using Thread.Sleep(1) to count down a timeout when waiting for data from a comport. I currently use 200 as my n value and this appears to cause the code below to take around 400ms on a machine with XP installed but on two other machines running Vista, it takes 3 seconds.
Is there something about Vista which causes the sleep to operate differently and is there a better technique that is recommended?
while (port.BytesToRead == 0)
{
if (--n < 1)
{
return 0;
}
Thread.Sleep(1);
}
Any help would be much appreciated!
Regards,
Christian
|
|
|
|
|
Ideally, you'd want to use a timer to time something. That way you know it will be exactly the same every time.
To achieve the same result, you could use a ManualResetEvent and a Timer like I mentioned:
ManualResetEvent wait;
Timer myTimer = new Timer(1000);
...
myTimer.Start();
wait.WaitOne();
...
void myTimerTick(...)
{
wait.Set();
myTimer.Stop();
}
The code will stop at wait.WaitOne until the timer is set off.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Hi,
While your code is a big improvement over the original one, your statement
SK Genius wrote: That way you know it will be exactly the same every time.
is overly optimistic. The delay will jitter due to timing uncertainty (see my timers
article), and of course every time you give up the CPU you are not sure to get it back
when you want it. There may be dozens of other ready threads, wanting to burn some
CPU cycles.
|
|
|
|
|
What can I say? I'm an optimistic kinda person
I suppose your right. It wouldn't be that far off though, a couple of milliseconds here, a few milliseconds there.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|