|
In fact, I tried the aforesaid code with the floating point numbers also, by replacing the first lines of the code (above) with the following sample code:
float minValue;
float val1 = 5.3214F;
float val2 = 7.7564F;
The result is still the same. The second method (i.e., the if-else method) is almost 100% faster than the first method (i.e., the Static Math method). The practical results on my machine were 17 seconds and 8 seconds respectively for 10 billion iterations for the said float numbers for the aforesaid two methods.
Regards
|
|
|
|
|
Without further investigation the second one would seem faster. If you really want to know for sure construct a simple test example that just reads each pixel on a bitmap and runs one or the other comparison and time the event.
However I would caution you about attempting optimization like this because premature optimization is evil. Without profiling tools trying to optmize can lead to confusing code and worse even worse performance (ie. producing bogus output, crashing, etc). The best optimization might happen outside of this code and quite possibly be in another part of the loop. Or ultimately, this is a "hardware bound" problem where no matter how much tweaking you do to code you are better off taking the amount of money they would have paid you to tweak code and buying new hardware with it.
|
|
|
|
|
Hi.I need an algorithm in C# or any other language for 2Dimensional Cutting Stock Problem.Please help me cause I m very worried about the result of my work.
|
|
|
|
|
Hi...
I have file with map in MapInfo format... How can i read this file using C#...
and how can i draw a map on form?
Greetings
Yarns
|
|
|
|
|
Can anyone guide me how to create auto hide feature.or can anyone give me sample code to create auto hide fucntionality in C# or in VB.NET.
Umair
|
|
|
|
|
If I understand correctly, what you want to know about is a window which hides automatically when the focus is moved away from it (for example certain windows in the IDE of Visual Studio .NET). If it is so, you may try to have a look at the source code here[^]), though you may have to go through tons of code.
|
|
|
|
|
Yes you understand correct,i need same effect.But i have found my own way,its quites simple and quites easy.Thx anyways
Umair
|
|
|
|
|
how did you do? Can you explain.
|
|
|
|
|
Is it possible to paint over the top of a child component without overriding the OnPaint function for the child component?
|
|
|
|
|
|
No, I am attempting to paint a grid in the forms OnPaint function but can't find a way of painting on top of the child controls.
|
|
|
|
|
Hi,
I want to be able to view pdf files in Winforms. The easiest way I could think of was to create a webcontrol in my winforms. I knew you could very easely do this in C++, but in C# I didn't find such a control. Looking on MSDN and CP I found things like WebClient and WebControl classes, but I can't figure out how they work, in what control do you view the actual page?
So there would be two possible ways I could think of:
1: Create a WebControl
2: Embed I-Explorer into the application.
Can anyone give me any advise what would be best and to what I should look for?
tnx!
No hurries, no worries.
[EDIT]
I found it, off course it was easy enough .
Choose add user control in the toolbox, under COM component choose Microsoft Web Control.
Add the webcontrol to your from.
That's it.
[/EDIT]
|
|
|
|
|
use axWebBrowser control, it is able to view pdf files and also other MS Office file, it is present on the left side panel,DATA panel or add it.
sample is like this
object empty = System.Reflection.Missing.Value;
webBroswerControl.Navigate("c:\\abc.pdg", ref empty, ref empty, ref empty, ref empty);
i hope it will help u
|
|
|
|
|
tnx! I found it before your answer, it was easy enough when I did find it, you only have to stumble upon it .
No hurries, no worries.
|
|
|
|
|
Hi,
you can use axWebBrowser control and call navigate method.
Thanks and Regards
SGS
|
|
|
|
|
tnx! I found it before your answer, it was easy enough when I did find it, you only have to stumble upon it .
No hurries, no worries.
|
|
|
|
|
Hello C# Professionals,
I really need to help of you..
I have a datagrid on my winform and I would like to open this datagrid as READ-ONLY...and then I would like to enable (write-enabled) a specific row with a button click..
I have written a code to select entire row in the datagrid.Now
----------------------------------------------------
private void grdPhone_CurrentCellChanged(object sender, System.EventArgs e)
{
this.grdPhone.Controls.Clear();
this.grdPhone.Select(this.grdPhone.CurrentCell.RowNumber);
}
-----------------------------------------------------
Now what will I do in the button_click event..??
Please help
|
|
|
|
|
Hello dear buddies,
I have read System.Reflection types that help to dynamically invoke object members are slow and are not suitable for high-performance applications.
My question:
Is the low speed because of the member search that is performed to find the requested member to get respectful 'MemberInfo' object (to invoke it) OR not only the member name search but also the member invokation using 'MemberInfo' object is a slow process itself?
A comparision between speed of direct method call and dynamic method call using 'MethodInfo.Invoke()' really helps me to find my answer too.
Thank you so much for any help and note
- Den
---
"Art happens when you least expect it."
|
|
|
|
|
Hi
iam tryin ro make programe about robot simiulation
please tell me how can i move and rotate objects ?
also i want to use pixels how can i do it?
tanks for your help and regards
|
|
|
|
|
That's a really generic question and way to large to be answered in the forums.
It doesn't sound like you have enough experience in the MANY different fields your going to need to accomplish this. I'd suggest picking up books having to do with DirectX, 3D modeling, and animation.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
is it possible to hide/disable console window at the time of calling some console command/utility from C#,for instance,when i call "DIR" command within C#,it first popsup console window for few seconds and then outputs data in the variable or file,whatever has been chosen
thanks
MyBlogs
http://weblogs.com.pk/kadnan
|
|
|
|
|
There are .NET equivalents you can use for the "dir" command. See System.IO.Directory/DirectoryInfo and System.IO.File/FileInfo.
That still doesn't answer your question though; this works for me with a cmd window:
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd");
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
System.Diagnostics.Process.Start( psi );
James
|
|
|
|
|
anyone out there know how to set a C# windows forms application to expire, say, after 3 months?
i'd really appreciated if you could point me in the right direction in trying to find out, thanks!
|
|
|
|
|
The easiest thing to do would be to put this into the constructor of the form:
if( (DateTime.Now - DateTime.Parse("20 February, 2005")).Months >= 3 )
{
throw new Exception("This application has expired");
}
Extending on that just a bit though you can use the License mechanism built into the framework.
[LicenseProvider(typeof(MyLicenseProvider))]
public MyForm : Form
{
License license = null;
public MyForm()
{
try
{
license = LicenseManager.Validate( typeof( MyForm ), this );
}
catch( LicenseException )
{
}
}
} Then code up your own MyLicenseProvider (using the base LicenseProvider class) to somehow know whether it has been 3 months.
All of this could be defeated with some work, but there are tools to help you combat that (Obfuscators, placing some important work along with the licensing procedure in native code).
The best way to stop it is to use a web service or remoting to do some important work and at the same time you can check whether the application has a valid license. This isn't appropriate for most applications though.
James
|
|
|
|
|
Hi,
I am Serializing an Object by using XmlSerializer but when XML file is created it is including the Namespace details like xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" in the Element.
But I dont want that Namespace details in the XML file.
Is there any way to do this.
Thanks for your help in advance.
Zaheer
|
|
|
|