|
Hello,
I have strange problem. In one of my project I used the "ParameterCollection" class to pass a number of SQL Command parameter to a method. In the first system I used like
ParameterCollection coll1 = new ParameterCollection();<br />
coll1.Add(new Parameter("categoryName", DbType.String, categoryName));
It works fine, but when I try the same code in a second computer it generates an error
"The best overloaded method match for 'System.Web.UI.WebControls.Parameter.Parameter(string,System.TypeCode,
string)' has some invalid arguments"
This confused me for a while, finally I figure out the problem when I tried the following at the new computer
ParameterCollection coll1 = new ParameterCollection();<br />
coll1.Add(new Parameter("categoryName", TypeCode.String, categoryName));
it works fine
But finally I got amazed when I saw the number of overloaded constructors in two systems are different.
In the first system it has 6 overload constructors for "Parameter" class(two of which support DbType as parameter ) and in second system it has only 4 overload methods(no DbType support).
In both system we used Visual Studio Express 2005 with .net 2.0 framework, but the only difference is the first system installed with Visual Studio 2008. will it affect ?
modified on Thursday, April 1, 2010 7:04 AM
|
|
|
|
|
I checked your scenarios on 2 machines and i got following results
PC having only VS2005
Parameter constructor had 4 overloads
out of which none supported TypeCode as parameter
PC having VS2005 & VS2008
Parameter constructor had 6 overloads
out of which 2 supported TypeCode as parameter
So I think the second PC has VS2008 installed in it so it contains an updated .Net Framework API
Tej Aj,
http://opexsolution.com/forum/
|
|
|
|
|
So this may be an issue, when you develop on a machine that has VS2008 and target version is framework 2.0, then host your application on a machine which only has framework 2.0. I am still wondering, installing VS2008 which means framework 3.5 on a machine update already installed framework 2.0 ? Or is this an issue of Service Pack ? So the portability of dotnet framework on question
Thanks for your effort
modified on Friday, April 2, 2010 12:29 AM
|
|
|
|
|
That would be a .net version issue, not Visual Studio.
You should have the latest version of .net installed regardless of whether or not Visual Studio is installed.
You could also develop for .net 2.0 even when using VS 2008.
|
|
|
|
|
But still i used the same framework 2.0 on two different machines, so I should get same number of constructors in two different machines, so how we rely on .net's so celebrated code portability and all?
|
|
|
|
|
Hi Guys,
I normally try to answer these sort of problems myself but i seem to be really digging myself into a hole here for a relativly simple question. Would really appreciate advice.
I have my main form: Creator.cs
On this form is an btnOption whick opens another form, Option.cs, and also a run program (GO!) button.
Option.cs contains two check boxes which are, by defualt Checked = true. I am happy with this and most of the time this will be the case.
However I want my program to check OptionBox.checkboxIncludeFiles and OptionBox.checkboxIncludeFolders too see if the user has unchecked them. I am unsure of how to look at the current values of these to implement it within the main() on Creator.cs. Just to clarify I'll put my ideal set up below, it's obviously wrong but just my guess.
Also, I am assuming here but changing the checkbox value and then closing the Option.cs form, the values for the checkbox reamin changed. As you may guess I am a little confused.
Many Thanks for any help!
Steve
Creator.cs
btn_G0_Click
{
if OptionBox.checkboxIncludeFolders.Checked == true
Run code with loop
else
Run code once.
}
|
|
|
|
|
If I get you properly,
you can set checkbox Modifiers property to public, will allow you to access of checkbox control and its property.
Never unload your options form. just hide from user.
Thanks
Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim
So Smile Please
|
|
|
|
|
Making controls of a form public is really a bad practice. We have properties and delegates to share data between the forms. One should make use of that.
|
|
|
|
|
You can make use of delegate and handle the check changed event for both the checkboxes in Creator.cs. In the event handler, assign the checked state values to a boolean variable. Then, you can use that in the Go button click event handler and proceed.
|
|
|
|
|
Ok so delegates seem to be the best option. These are completly new to me. How do I assign the boolean variable to a delegate and how to I pass it to Creator.cs?
Anything is useful, I'm having a look at delegate tutorials now.
Many Thanks again
|
|
|
|
|
Steve-Co wrote: How do I assign the boolean variable to a delegate and how to I pass it to Creator.cs?
You do not need to do this. You need to handle the check changed event of the checkboxes in Creator.cs. In the event handler, assign the check state to a boolean variable declared in the Creator.cs. Something like this:
class Creator{
public bool includeSubFolder = true;
private void CheckChangedEventHandlerMethod(object sender, CheckChangedEventArgs e){
CheckBox chk = sender as CheckBox;
if(chk != null){
includeSubFolder = chk.Checked;
}
}
} *
Steve-Co wrote: Anything is useful, I'm having a look at delegate tutorials now.
This[^] is what I found right now. It is for a web control, but the concept remains the same.
Hope it helps.
*Code might not work since I typed it right here and not in VS. Please bear.
|
|
|
|
|
You can
0) Pass the checkbox.Checked property values to the child form, or
1) Specify the child.Parent property to this from the parent form, or
2) Create a static class that holds the values of the parent checkbox.Checked properties and refer to that static object from both forms.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
...
3) Define a class to hold the configuration, create and pass an instance of it to the child, which can then set it as required.
|
|
|
|
|
Thank you all for your replies.
As I stated this was a simply problem and I choose to solve the easy way. Put the check boxes in Creator.cs rather than in a different cs.
One day i'll hopefully understand and implement properly. I understand this shouldn't be difficult. I just need to clear my understanding of OO.
Thank you all for your help
|
|
|
|
|
Dear all,
Currently, I'm finding the best sort algorithm for my case as below:
I already have 3 input arrays that are increment sorted by times (each array contains about 1,000,000 elements).
Now, I want to merge 3 arrays to one arrays (of course, it must be sorted).
Pls. support me to find the best way to do it, to improve performance as much as posible.
Thanks for your support!
|
|
|
|
|
Hi,
the best sorting algorithm for you're case is [Quicksort].
For you're 3 arrays:
A, B and C, you can merge A with B into D, then sort D.
Afther that, merge D with C into E, then sort E.
The final result will be the E array.
Cheer's,
Alex Manolescu
|
|
|
|
|
Thanks Alex,
Can you explain more detail?
Now, I'm undestanding: Quicksort is used for sorting D array after merge A & B.
1. If that's right, why don't we use merge sort to merge A&B to sorted D array?
2. If wrong, which algorithm you use when merge A&B?
|
|
|
|
|
Hi,
the example that i provided you is just an example. You can find many ways to sort an array.
For you're questions:
1. yes, you understand right! of course you can use merge sort if you wish, i've provided you just an example.
(another example: you can use quicksort to sort array A and B, then apply quicksort on D array!)
2. you can loop trough array A and B to fill the D array.
To see which algorithm is better try to set a timer at the start of the algorithm and at the end you'll see which is more faster
Cheer's,
Alex Manolescu
|
|
|
|
|
This[^] should help you choose one.
|
|
|
|
|
Do you actually need to sort them?
If the three arrays are already sorted and you just need to merge them then you could loop down them in parallel and copy the smallest value to the new array.
You need to increment the index for the copied value only and then loop around again.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
To find the best sort algorithm you must first get the value of each algorithm and then sort them...
|
|
|
|
|
Here's an implementation that does what I think you want.
Note: it uses Lists instead of Arrays. If you must use arrays then the output array must be big enough to hold all three input arrays.
Note: it relies on having a value (HIGH_VALUE) greater than any that can appear in any of the input arrays.
I've not done an analysis but don't think you can do it quicker. This goes through each array (List) only once. Any other approach probably needs multiple passes through the arrays.
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class Program
{
static List<int> listA = new List<int>();
static List<int> listB = new List<int>();
static List<int> listC = new List<int>();
static List<int> listOut = new List<int>();
static void Main(string[] args)
{
MakeSortedLists();
const int HIGH_VALUE = int.MaxValue;
int m = 0;
int i = 0;
int j = 0;
int k = 0;
int valueA = listA[0];
int valueB = listB[0];
int valueC = listC[0];
while ((valueA < HIGH_VALUE) || (valueB < HIGH_VALUE) || (valueC < HIGH_VALUE))
{
if ((valueA <= valueB) && (valueA <= valueC))
{
listOut.Add(listA[i]);
i++;
valueA = (i < listA.Count) ? listA[i] : HIGH_VALUE;
}
else
{
if ((valueB <= valueA) && (valueB <= valueC))
{
listOut.Add(listB[j]);
j++;
valueB = (j < listB.Count) ? listB[j] : HIGH_VALUE;
}
else
{
listOut.Add(listC[k]);
k++;
valueC = (k < listC.Count) ? listC[k] : HIGH_VALUE;
}
}
m++;
}
WriteOutList();
Console.ReadLine();
}
static void MakeSortedLists()
{
listA.Add(10);
listA.Add(11);
listA.Add(2);
listA.Add(1);
listA.Add(16);
listB.Add(5);
listB.Add(13);
listB.Add(7);
listC.Add(10);
listC.Add(6);
listC.Add(16);
listA.Sort();
listB.Sort();
listC.Sort();
}
static void WriteOutList()
{
Console.WriteLine("Posn Value");
Console.WriteLine("-------------");
for (int m = 0; m < listOut.Count; m++)
{
Console.WriteLine("{0,3} >> {1,4}", m, listOut[m]);
}
}
}
}
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
|
Hi, I would like to know if you can help me, I started working with Sharepoint about 2 weeks ago. Now, I work for a company that develops SP Sites etc. for other clients. I receiverd the task of creating an application with a user interface that backups what you choose to backup.
This must be a full on working application where you can choose the site, then subsites, custom web parts and custom master pages to backup. You must also be able to backup an entire site from the application.
I come from a web development background but have never worked with backups etc...so I have no clue where to begin.
I have spoken to my senior and he saiod that we would have to build everything from scratch and that we would not be able to use either the integrated Sharepoint.Administration.Backup or stsAdm.
Someone said I must look at the SPExport commands and to export the site as a template.
I cannot find sufficient info regarding backing up the site on the net as it is only the usual.
Have anyone done something like this before?
Please help
Jurie
|
|
|
|
|
I must build a program to solve 8-Puzzle with best first search algorithm , but i don't know how to do it.
You can build it in C# help me ( with source code)
Thanks!.
|
|
|
|