|
If you thought that the Managed DirectX is REALLY "managed" you are terribly mistaken. It is nothing more then an MUCH improved wrapper for the Direct X unmanaged code. But still it is not too far off from a standard Interop assembly automatically generated by tlbimp. So I don't think that you will be hurting your design much by using Interop DirectShow.
|
|
|
|
|
Then I have been terribly mistaken, but thanks for being a light in a very dark tunnel...
At least now I know where I stand, and if I notice performance issues I might look more into C++.
-thorbeck
"Computers are stupid,
they can only give you answers."
picasso
|
|
|
|
|
I'm using a float to keep track of a scale factor -- sounds easy enough. When the user clicks a button I either add or subtract 0.10F from the scale value (it starts at 1.0F). After several iterations I start to see the value varing by a small amount i.e instead of 0.80 I get .7999. This seems like a large error for a simple addition or subtraction operation... Any insights?
|
|
|
|
|
This is because of the internal representation of a float type. When you store a number in a 32-bit float, you're not storing the absolute precise version of the number. You actually storing a mantissa and exponent. Try this[^] for a very short explanation as to why...
0.1 in decimal does NOT = 0.1 represented in IEEE754 format.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'd have to read the IEEE754 spec to see why it's different than normal FP calculations, i.e. the same calcutions in C/C++ work fine with floats, but are way off with both floats and doubles in C#. I understand the internal FP representation, but I haven't seen this bad/apperant/annoying of a problem for some years, hmmm maybe somewhat over a decade or more....
|
|
|
|
|
I've had to deal with it for years. I've always used the 'integer' technique simply because math with int's are much quicker than with floats. Only when I must use floats/doubles do they get converted back to their floating point counterparts.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Use an integer for the scale factor.
Start at 100:
int iScale = 100;
Move up or down by 10.
iScale += 10;
Convert to float before using:
float fScale = (float)iScale/100f;
This should keep your scaling the way you want.
|
|
|
|
|
Thanks. I had considered the integer solution, it will work for the case outlined but if the scalinng capability is expanded to include "To width" etc... it may not not work as well, though I may be able to adjust the precision to account for those situtations.
|
|
|
|
|
Have you considered using the decimal data type? It does not lose precision since it is intended for decimal arithmetic.
|
|
|
|
|
Decimal is also 128-bits in size compared to the 32-bit for a float... A little overkill for the application...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
Decimal is also 128-bits in size compared to the 32-bit for a float... A little overkill for the application...
Yes, decimals are stored as 16 bytes (but only 13 of them are used, pity) In any case they're much slower than a float, since they are structs and do not have hardware support. But I think it's OK unless you're programming a game or an embedded system in a spaceship
|
|
|
|
|
No, I don't think that I'll use decimal, espcially since I was worried that converting the int to a float every thime the window was invalidate would be too expensive (a few second later I figured out that I could store both -- do the math on the int and convert to float whe the scale changes.)
I guess the major question is why when you write a prog in C/C++ do you get the "right"/expexted answer and in C# you don't. Ah well, if it still bothers me tommorrow I may take a journey down assembly lane and look at the disassembly for the C code. Another thing I was considering checking is to simply assign various values to a float an view the results...
|
|
|
|
|
Hi Heath,
You told me about putting an Update statement followed by a semicolon with select for my dataadapter.Update command. Can I use this same syntax for the dataadapter Insert and delete commands as well or does this only need to be done for one of them and the others respective commands will use the same select?
Thanks,
JJ
|
|
|
|
|
No, I said to use an INSERT followed by a SELECT. This is to ensure that any fields filled by the database engine are reflected in your DataSet . An UPDATE doesn't require this - you already have the field values.
See my previous post on this subject here[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Re: Adding Rows to Dataset Heath Stewart 19:29 13 May '04
Use something like the following for your SqlCommand you set as the
Heath Stewart wrote:
SqlDataAdapter.UpdateCommand:UPDATE MyTable SET Field1 = Value1; SELECT * FROM MyTable;
The SELECT statement should actually match the SQL statement you use for your SelectCommand.
Microsoft MVP, Visual C#
This is what u said here <link[^]>http://www.codeproject.com/script/comments/forums.asp?msg=821216&forumid=1649&XtraIDs=1649&searchkw=commandbuilder&sd=5%2F10%2F2004&ed=5%2F26%2F2004#xx821219xx
Did I interpret this wrong ?
JJ
|
|
|
|
|
No, that was a mistake on my part. But if you look at the reply to your post earlier today I did state to combine your INSERT statement with your SELECT statement.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I fixed the linked post for posterity.
If you want to see an example of what you need to do, you could use the designer in VS.NET. The DataAdapter -related designers will help you fill all the commands of a DataAdapter and the InsertCommand will contain both an INSERT and SELECT statement for the very reasons I mentioned.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I'm entering new territory for me here, so I appologise in advance if I dont't use the correct terminology. I want to communicate between to programs on the same computer. The best annaology I can come up with is how Winamp or MediaPlayer allows you to enqueue files from the Shell menu to the running application. I want to specify a file to import into a running application. Whats the best way (no security needed) to create a communication channel where I can send a string from one app to another. I've started looking into Remoting, but this might be overkill. Could I use the FindWindow and SendMessage APIs to send a string to my application ? If so how do I check for these incoming messages ?
Any suggestions would be helpful. Thanks.
|
|
|
|
|
I'm going to let other people get into some of the details because my experience with Remoting is lightweight compared to other people here...
You're looking to have a 2nd instance of an app throw a string, or whatever else, at the 1st instance of your app, then quit.
Remoting is not the overkill you would think it is. It's actually going to give you the best bang for your buck as far as flexibility, being able to pass any object you want and send information back to the caller.
Using the SendMessage and FindWindow API's is actually a VERY limited method of communication and frankly, not that reliable in this case you have to garantee that the window that your talking to isn't the window your sending from. In others words, an instance of an app can end up talking to itself instead of a previous instance. Plus, you have to register your own custom message and you would have to pass a pointer to a String or other object. You can't send a copy of the string itself.
There are a couple of other methods that are written up in these articles on CP here[^], here[^], and here[^]. But these methods are not elegant, more like hacks really (no offense ) because they can't be written in totally managed code, and have their pitfalls and, I think, are limited to just passing a single string.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the info....you suppose you could suggest an approach in Remoting ? Since I have no experience, your "lightweight" experience is more than I have...
|
|
|
|
|
is it possible to create a new group at run time?
|
|
|
|
|
With the VERY limited experience I have with Crystal Reports, no you can't. I believe report classes are immutable at runtime.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The report definition in CR for VS.NET is read-only. You could take a look at their newer, full-fleged products. This isn't a Crystal Reports forum, though, so you should direct your questions to their site.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I believe you would need the "Advanced Developer" version of Crystal Report 10 to be able to do that.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
THanks ,I'll try out their trial version
|
|
|
|