|
Hi,
I am using the CSML libraries which are just what I need. However, it looks like the precision when doing matrix manipulations (taking inverses and matrix multiplication) is only to 4 decimals, even though I'm using doubles. Internally it has to be using many more, but I can't get it to display or use more in further calculations. Suggestions please.
Linda
Linda Woodard
|
|
|
|
|
Hi,
I'm not familiar with the CSML libraries. AFAIK there are only two ways to get bad results with matrices: using a bad algorithm (e.g. not applying pivots), which I don't expect a library to get wrong; and operating on very peculiar matrix values (as in searching the intersection of two almost parallel lines).
Of course, you may have made some silly mistake somewhere outside the library too, as in performing some operations in lower precision, maybe in integers.
Example: int a=1; int b=2; double c=a/b*100.0; would yield c=0.0; !
|
|
|
|
|
I think it's only a matter of displaying the result. Check out some topics on number formatting in MSDN, that should help. Try for example
double x = SomeCalculation();
string resultToDisplay = x.ToString("F9");
to get 9 significant digits, but I am sure there are better ways.
H.
|
|
|
|
|
Thanks. I think this will help. I need to actually use the results, not really display them, but I know how to do that. Painful and inelegant, but at this point...
Linda
|
|
|
|
|
This looked like it should work and it does if you are dealing with doubles. Unfortunately I'm dealing with matrices and the Matrix.ToString() does not take any arguments. So I'm still looking.
Linda
|
|
|
|
|
Hi there,
Thanks for taking interest in my question. Actually, I wanted to know the process of creating a Gel Button (Stylish, glowing, shining and colourful button control) in Visual C#. I went through many tutorials in both google and MSDN, but all of them mentioned WPF in them and the code was in XAML. I have not started programming in XAML or WPF yet, but I know that they can be used to create graphically rich UI applications. However, is there any way I can create Gel buttons in Visual C# for my Windows form? Please help.
Thank you,
Rajdeep.NET
|
|
|
|
|
|
Hello,
I have been struggling for the past 3 days to do this but I simply can't find any good info on how to do it.
Please let me explain what I want.
I have a compiled software. I want users to be able to brand this software with their own ICON, ABOUT IMAGE and DETAILS.
How can I do this ?
In my oppinion, there are 2 ways to do this :
add the image and details file in to the exe and also, change the exe icon. I don't think this is possible.
create an exe from my application, that will automaticaly add in it the Brandable Software File, About Image and Details file. When I run this newly created exe, it can extract the files in a temp file and run the Branded software.
How can I do that ? Is there any other way ? Did I explain correctly what I want ?
PS: I am programming in VS 2008 c# with .net 3.5
Thank you
|
|
|
|
|
sodevrom wrote: create an exe from my application, that will automaticaly add in it the Brandable Software File, About Image and Details file. When I run this newly created exe, it can extract the files in a temp file and run the Branded software.
How can I do that ? Is there any other way ? Did I explain correctly what I want ?
Hello Sodevrom,
Generating an .exe (executable) file from within your application is an impossible task! But yes, other executable files can make your way, like files with .vbs and .bat extensions (which are also executable). The source files are written in Notepad as usual and then are saved with a name and a required executable extension. You can use the FileStream property of .NET to create a notepad file and write the code to it. Then, you can use the File.Move(); function to rename the file to any execuatble extension you want, but not any .exe. Hope this information helps. For more information, search Google or MSDN.
Happy Programming,
Rajdeep.NET
|
|
|
|
|
|
Hello,
This is not exactly what I need. A friend of mine made me a DLL a while back, that had 3 functions :
start_exe(string exe name)
add_file(string file path,string source path)
create_exe(icon path,string file_of_the_file_to_run_when_oppening_exe)
And it worked perfectly in C++, but it does not work very good in c#.
Any other ideeas ?
|
|
|
|
|
You want to replace resources in an existing .exe file?
If the .exe file is a .NET assembly, that's pretty easy. Take a look at Mono.Cecil[^].
|
|
|
|
|
Hello,
This is pretty difficult. Are you sure this will modify the resources from a .exe from another .exe file.
So if I have APP1 that controls APP2, can I modify the resources of APP2 from APP1 ?
Thank you
|
|
|
|
|
Yes, Cecil can open .exe files, modify them, and save back the changes.
Use something like this:
AssemblyDefinition asm = AssemblyFactory.GetAssembly("myassembly.exe");
asm.MainModule.Resources.Add(new EmbeddedResource(
"ResourceName", ManifestResourceAttributes.Public,
File.ReadAllBytes("image.png")
));
AssemblyFactory.SaveAssembly(asm, "myassembly.branded.exe");
|
|
|
|
|
Hi,
Cecil is great, actualy it's perfect.
I have only one last request. Can you please tell me what would I have to do to change the default icon of the exe ?
I am not lazy, but I am finding Cecil pretty difficult.
Thank you again very much
|
|
|
|
|
Hi,
Create a DLL trigger for your application. Thats the easiest way. And by the way, C# enables you to create DLL the much better way, than any other language!
|
|
|
|
|
Hello,
I was wondering if anyone could tell me if what I'm trying to accomplish is possible.
I am using C# in VS 2008.
I have two project templates and another template which links the two projects and calls their templates. The first project is a user control and the second is a test app that needs to reference the user control. I also have a custom wizard that is called from the template. After the projects are created the wizard compiles the user control and gets the path to its dll. I then need to add a reference to the user control from the dll path to my test app. It is not possible for me to add the reference before this as I don't know what the name of the dll will be until the user creates the new user control project giving it whatever name they want. Does anyone know how this could be done?
|
|
|
|
|
Maybe Reflection is what you want, google it.
|
|
|
|
|
Thank you for the reply.
I've been googling for about a week and tried many different things including reflection. I tried Assembly.LoadFrom(dllPath) in the wizard but that just adds the reference to the project that the code is in. I checked out reflection where you can get the type and instantiate an object of that type and call methods from it, but that object is already created. I don't want a new one. When I set an assembly variable in the wizard equal to the assembly of the object needing the reference, the LoadFrom function doesn't exist.
|
|
|
|
|
I found the answer on another forum.
// Provide the information about project1 to project2
VSProject projectWithReferences = project2.Object as VSProject;
if (projectWithReferences != null)
{
Reference reference = projectWithReferences.References.AddProject(project1);
}
|
|
|
|
|
|
It is remote, i don't think so.
|
|
|
|
|
So I assume that the way I am currently doing it is the only way? Any other ideas?
Thanks
|
|
|
|
|
You are right, the only way is to check with a timer because it is remote. Since remote server doesn't let you know when anything changes, it is not possible. Your app should check.
|
|
|
|
|
Hi
In my program I call a win32 API function which returns a function pointer as its result. How can I store and 'call' this pointer in C#?
The API function in question is LRESULT SendMessage(...) , which I map as IntPtr SendMessage(...) . The function whose pointer is returned by SendMessage has the form
int fn(void*, int);
so I created a delegate
delegate int RemoteFunction(IntPtr a, int b)
and I try to convert the IntPtr (originally LRESULT ) returned by SendMessage to an 'instance' of this delegate, like
RemoteFunction x = (RemoteFunction) SendMessage(...); // compiler error
So far I wasn't able to come up with a code that would at least compile, not to mention work.
Do you have any suggestions?
Any help appreciated, H.
|
|
|
|