|
Well, it's way too much code to expect anyone is going to read it all, that's why I suggested a breakpoint or some logging code, to see if they are actually all being moved, and what the result is.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm not familiar with how windows seeds its Random number generator but if it is like others I've used they are often seeded with the system tick if you don't specify a seed value. You create a new generator for each being, and I bet they all get started with the same seed so they're just drawing over the tops of each other.
Either use one Random() to rule them all, or put some sort of delay between calls.
|
|
|
|
|
I think I got it. For some reason whenever you start a new instance of being...the random that I start an instance of is just about always the same. However, if I run the random from the main program...it actually creates a random position...odd...Thanks guys.
|
|
|
|
|
It's not odd, it happens for exactly the reason you were just told it would happen.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
No, not odd. Understand how a Random Number Generator works. There's no such thing as a truely random number in a computer. They can't come up with a number out of thin air. Even humans can't do this reliably.
The RNG is a smallish piece of code that takes a starting number (a seed) and puts it through a complex calculations to arive at a new number. The next pseudo-random number takes the previous one and runs it through the same math to arrive at a new number, and so on, and so on.
This generates a string of REPEATABLE pseudo-random numbers, given any seed value.
As the previous poster said, if you don't give a seed value when you create your Random object, the timer value is used. All of your objects are creating their own Random object, but they're all seeded with the exact same value! There result will be all of of those Random objects each generating the exact same string of numbers!
Typically, you'd create a static Random somewhere, much like a "global variable", that all of your code can get to. That way, you only have one source of random numbers, which will give you a closer approximation of "random" acrossed your code than having multiple sources.
|
|
|
|
|
Hi
I have an array of integers, where each one is an index for an array of objects, and I'm trying to sort the array by the .name property of the objects. I've set up a class using the IComparer interface to do this.
List<int> SubjList = new List<int>();
SubjectIndexComparer<int> subjectIndexComparer = new SubjectIndexComparer<int>();
...
SubjList.Sort(subjectIndexComparer);
public class SubjectIndexComparer<T> : IComparer<T>
{
...
public int Compare(T x, T y)
{
string textX = Singleton.Instance.subjList[(int)x].name;
string textY = Singleton.Instance.subjList[(int)y].name;
...
}
}
However, this doesn't work because I can't cast x and y from type T to int. I only want the function to work if T can be casted to an integer. How can I implement this? I don't actually need the function to be generic, it would be fine if it just took integers, but the List.Sort() method required that form. Thanks in advance.
Jack
|
|
|
|
|
Why don't you try with:
public class SubjectIndexComparer<int> : IComparer<int>
{
...
public int Compare(int x, int y)
{
...
}
}
? Does that helps?
|
|
|
|
|
I tried with:
public class SubjectIndexComparer : IComparer
{
...
public int Compare(int x, int y)
{
...
}
}
but I got:
'UQTimetable.SubjectIndexComparer' does not implement interface member 'System.Collections.IComparer.Compare(object, object)'
I tried with:
public class SubjectIndexComparer : IComparer
{
...
public int Compare(object x, object y)
{
...
}
}
but I got:
The best overloaded method match for 'System.Collections.Generic.List<int>.Sort(System.Collections.Generic.IComparer<int>)' has some invalid arguments
Argument '1': cannot convert from 'UQTimetable.SubjectIndexComparer' to 'System.Collections.Generic.IComparer<int>'
Any more ideas?
Jack
|
|
|
|
|
Use this:
public class SubjectIndexComparer : IComparer<int>
{
public int Compare(int x, int y)
{
...
}
}
|
|
|
|
|
that's what I meant... tnx for correcting me Daniel.
|
|
|
|
|
Worked a treat! Thanks
Jack
|
|
|
|
|
We have about 13 services that my service manager is starting up. All are ServiceHost objects. Some of the services will optionally inherit an IServiceRequestor interface that exposes an initialize and terminate routine that I need to call at startup and shutdown of the service.
Problem: The object is encapsulated with the ServiceHost object and I cannot find where I can access the class to run the routines.
Has anyone done this? How do I get at the encapsulated object to cast it to my IServiceRequestor object so that the intialize and terminate methods are executed within the ServiceHost's AppDomain?
|
|
|
|
|
Hi All,
I'm creating an application with a form that spans the length of the screen i.e. 1024x100 on a 1024x768 screen. Is there a way that i can reposition the 'usable' window to begin at the bottom left corner of the form? For example, if I open IE or Notepad, when maximized, the top most corner would be (0,668). Currently when I maximize IE, most of the menu appears under the form.
Any help would be appreciated
Thanks!
DLee
|
|
|
|
|
Hi,
I'm working on a C# project in which there's a conflict between two dll-files (office automation dll's, version 2.1 & version 2.4), forcing me to manually copy the second dll to the "bin/Debug" folder instead of referencing to it in the solution. The problem is that the project needs to be distributed using the ClickOnce publish feature in Visual Studio 2005, and the second dll is not added to the distributed version of the project.
Now I need this file to be included into the publish procedure, so it is added in the result and can be used. I have been exploring VS 2005, but I didn't find any solution up till now.
Is there a way to auto-include non-referenced dll files to a publish, or will I need to solve the dll conflict in another way?
Both dll files have a different name and the project runs as it should, but the "old" dll file does not completely support the features we are using. And upgrading the old functionality to the new Office dll is also not an option .
Any help is appreciated!
Greetz
|
|
|
|
|
If I understand you correctly this should solve your problem:
1. Copy non-referenced dll to your project's directory and add it to project using Add -> Existing Item -> browse to dll.
2. When it is added to project, right click in it on Solution Explorer -> Properties and Set Build Action -> Content (ClickOnce problem) && Copty to Output Directory -> Copy Always (autocopy) in Properties Window
3. If you now right click on your project icon in Solution Explorer -> go to project Properties -> Publish -> Application Files, you should see your dll in list with status Include(Auto).
Hope this solves your problem, if not -> give more details and I'll answer .
Cheers!
|
|
|
|
|
I tried your solution, but when debugging, the second dll file (office 2007 dll) is not copied to the Debug folder, only the first one (office 2000 dll) is copied. If I remove the reference to the first dll than the second one is copied. So it seems that only one of the dlls can be in the compiled result. I assume Visual Studio detects an Assembly name or something and this name is the same in both dll files.
I managed to get both dll files in there by adding them both manually and setting build action to "None" and Copy to Output Directory to "Copy Always". The problem is that when debugging, the program crashes with an error that the second dll file could not be found.
I'm out of options at the moment.
Hope you can help me.
|
|
|
|
|
Hello everyone,
I have a Windows Application with all sort of controllers such as ListView, TextBox, Buttons, ComboBox and so on. I undrestand that I should dock the controllers so once the user changes the Window Size the Windows Application doesn't get ugly anf messed up and still useable.
I was wondering if anyone can take a moment and explain if there are any particular order that I should follow since whatever I am doing there is always one or two controller running over another ones.
Thank you very much and have a great weekend.
Khoramdin
|
|
|
|
|
I'm really not sure of your question, this article might help though: Working With Anchoring And Docking
If not, let me know.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Hey
I need to be able from my ASP.Net to add a static a-record for some websites
So how do I do that ?
Examles
Adding
"testside" 10.2.6.244
"sales" 10.2.6.244
"tech" 10.2.6.244
It is for a Windows 2003 DNS, I have have all the security right, and are able to do impersonation if thay should be a problem..
|
|
|
|
|
Research this: DNS WMI Provider.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I have project and store the name of this project forms in a database table,
the start up form will show the other project form in a tree view and store the description of that forms and its names
on mouse double click i want to create instance of a form in the selected node with out knowing the name of that form not hard code
also i dont know how to use the system.reflication
please can any one help me
Hosam Taji
|
|
|
|
|
Can I ask why the duplication ? What if a form name changes within the project, the database will be wrong. Why do you need to use reflection at all, if you know the names of all the forms, to store them in a database table ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
what if i have more that 1000 forms in my project do i have to write code for each form in its name to call it, also my project is multilengual and the user can change the form descritpion and loacation in the tree throw a spechle forms so that why i use the database !!!!
i do all these in other languge like oracle developer and know i am trying to do so in C# windows application to let my team enter the information about the forms in the database and then the startup form will call these forms automatic
Hosam Taji
|
|
|
|
|
hi
is there any free component or class to co convert Html to PDF and support Unicode charrecters
with regards
MHF
|
|
|
|
|
Hi every one
i have a form name sotred in string parameter
i want to create object from that form and show this form
thx
hosam taji
|
|
|
|