15,885,365 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by GParkings (Top 52 by date)
GParkings
21-Feb-12 9:04am
View
I agree. I would STRONGLY advise you reconsider your choice of project. As a developer with 10+ years experience I would be extremely reluctant to tackle a project such as this without at least one team member highly experienced in this field to act as senior/principal developer.
The algorithm required would more likely be considered a Phd level project than a dissertation for a bachelors degree (I'm assuming that's what you intend for this project)
GParkings
21-Feb-12 8:41am
View
Changed your title to be a little less misleading and countered the downvoting a tad :D
GParkings
21-Feb-12 8:38am
View
very good answer to a blatant homework question
GParkings
21-Feb-12 8:18am
View
if you haven't already it would be good to post this as a tip.
Its useful to know and might get missed buried in the Q&&A section :D
GParkings
14-Feb-12 7:15am
View
did you also override the GetHashCode method?, you should have, .. post that code up as well
GParkings
14-Feb-12 5:48am
View
its the extra '}' before or after //Response.Redirect("./default.aspx");
GParkings
13-Feb-12 5:57am
View
Deleted
you will also get a deprecated code warning using the compiler. I have used it in the past (created a mini IDE for specifying a single method body of logic in a plugin system) but needed to pragma the warning away
GParkings
15-Sep-11 15:45pm
View
Deleted
thank you for adding a comment to your 1 vote. I would say though that, although possibly obvious to you, I had not seen this used in 7 years of software development. That is why I figured it warranted a tip.
GParkings
13-Sep-11 10:10am
View
Please don't post questions in all caps, its considered 'shouting' and not very polite. I have re-written your question in appropriate case and also formatted it a little better so as to be more readable
GParkings
8-Sep-11 12:04pm
View
is this your homework?
GParkings
8-Sep-11 5:06am
View
doh! my bad, blame it on caffeine deficiency.
Thanks for the catch, and the formatting
GParkings
8-Sep-11 4:24am
View
I modified your snippet to not use the reserved word 'class' as the instance name. I know it's just example code but the syntax highlighting made it a little confusing to read. hope you don't mind :)
GParkings
8-Sep-11 4:19am
View
A believe there is a construct in Java that, superficially, appears to be similar to the .Net nested class construct but is tied to an instance of the outer class rather than the type definition. This can cause some confusion for Java developers that don't fully understand whats going on 'under the hood' trying to apply the same concepts to a .Net language. Not sure if this is the case here but i have heard of it catching people out.
GParkings
7-Sep-11 15:01pm
View
I would also add that requirements analysis is equally as important a skill for a developer as coding ability, therefore even though you don't appear to be asking for code here you are still 'gimping' yourself by trying to get someone else to figure this out for you. If your tutor is acting as your client in this assignment i suggest you sit down with them and define their requirements
GParkings
7-Sep-11 14:45pm
View
wow, that first screenshot literally sent shivers down my spine!
sorry, that's not very constructive. how about this:
- does your user really need to edit 16 subscriber's data simultaneously? if not, consider revising the data entry screen to a single subscribers details along with a list/tree of records and some add/remove buttons. when a subscriber is selected in the list populate the controls with their data. This way you get a lot better use of your screen real-estate
- from what i gather of your requirements, each of those tiny textboxes is supposed to hold a mobile phone number. simply put, the data doesn't fit in your UI. In the UK at least, such numbers are 9 digits long, your textboxes will hold about 3
personally i would go for a treeview with the following structure in a left-aligned splitter panel defaulting to about 15-20% screen width with the remaining space used for controls that are contextual to treeview selection
person
-subscriber
--number
--number
-subscriber
--number
--number
person
-subscriber
--number
--number
-subscriber
--number
--number
in such a system each node type would set up different controls in the main part of the screen:
person - name, hex value and source entry
subscriber - number entry (a list of numbers with add/remove buttons and a single number entry textbox populated dependent on number selected in the list)
number - not selectable, this is purely for user reference and could be omitted due to the list shown when the subscriber is selected. It all depends on how often your user will need to simply view the data rather than edit it
I think you'd find such a UI easier to maintain and more intuitive to use :)
GParkings
7-Sep-11 12:34pm
View
yes thats true. But there were 2 existing solutions almost identical to yours before you added yours. To be honest, just one of these 3 solutions would suffice and the other 2 are redundant, myself and Mehdi posted at almost exactly the same time so that duplication was unfortunate. The third repition was avoidable ;p but, as i said, i like the addition of the converter link :D
GParkings
7-Sep-11 12:23pm
View
sadly the my office blocks access to dropbox so i cant see the screenies. I'll take a look when i get home
GParkings
7-Sep-11 11:45am
View
have a 5 for the converter link, though you were beaten to the solution by a good half hour ;p
GParkings
7-Sep-11 11:30am
View
yup .. dead on, 5 from me too (did it earlier in fact :))
GParkings
7-Sep-11 11:25am
View
I formatted your XML for you to make it a bit easier to read. Whilst i was doing so i noticed a few issues with it with regards to being 'well-formed'. This is most likely a side effect of the CP editor but if this XML is derived from real data and you get parse errors on that take a look at your subscriber2 close tags and the spelling of 'two' :)
GParkings
7-Sep-11 11:09am
View
Deleted
Happy to help. Feel free to mark the solution as accepted so i can get me some rep points (I'm nearing a threshold that will give me additional editing powers.. means i get to be more helpful)
GParkings
7-Sep-11 11:00am
View
yes, from what you describe, the 2nd solution is what you need.
It might be more clear if i write the pseudocode of what it does anf you can see how that tallies with your requirements:
1. determine lower range of interval from user supplied reference (diffminus)
2. determine upper range of interval from user supplied reference (diffplus)
3. set flag to indicate we havent found a match yet
4. loop through the unfiltered list doing
a. check if the value is inside the range (diffminus to diffplus)
b. if it is check to see if we have found a match before
c. if we havent, adjust the range limits (diffminus and diffplus) according to the unfiltered number we are currently looking at
d. if we found a match add it to the filtered list
5. output the contents of the filtered list
GParkings
7-Sep-11 10:12am
View
Or if you only want to adjust the interval on the first match:
List<double> filtered = new List<double>();
double difminus = reference - factor;
double difplus = reference + factor;
bool firstMatchFound = false;
foreach (var t in unfilterednumbers)
{
if (t >= difminus && t <= difplus)
{
if(!firstMatchFound)
{
difminus = t - factor;
difplus = t + factor;
}
firstMatchFound = true;
filtered.Add(t);
}
}
string s = "";
foreach (var st in filtered)
{
s += st.ToString() + "\n";
}
MessageBox.Show(s);
GParkings
7-Sep-11 10:10am
View
List<double> filtered = new List<double>();
double difminus = reference - factor;
double difplus = reference + factor;
foreach (var t in unfilterednumbers)
{
if (t >= difminus && t <= difplus)
{
difminus = t - factor;
difplus = t + factor;
filtered.Add(t);
}
}
string s = "";
foreach (var st in filtered)
{
s += st.ToString() + "\n";
}
MessageBox.Show(s);
GParkings
7-Sep-11 4:18am
View
can you provide a sample string where the match is not occurring?
GParkings
7-Sep-11 4:11am
View
(count/totalcount)*100 is mathematically synonymous with (count * 100) / totalcount
GParkings
6-Sep-11 10:05am
View
I'm putting this in a comment as i don't think it will fix your stated problem but will probably bite you in the future, regardless:
1. Unless your minWidth, minHeight, MaxWidth and maxHeight values are of the form: initial value + n*16 then your if conditions will never resolve to true.
e.g. if your initial height is 10 and your maximum height is 40 the first increase will put your height to 26, the second to 42. At this point you have exceeded your maximum but your condition (height == 40) has not resolved to true (i suggest a >= on maxmiums and <= on minimums)
2. your first and second If statements are (or should be) mutually exclusive and can therefore be simplified to an 'if..else if' statement
GParkings
6-Sep-11 9:19am
View
Have you made any attempt yourself so far? if so, where did you get stuck? post up your work so far and we can give you some guidance on it.
as it stands its not clear whether your question is regarding how to create a flow chart, how to compute a factorial or how to use a loop construct
GParkings
6-Sep-11 7:15am
View
no worries, i'll upvote it now its fixed
GParkings
6-Sep-11 6:45am
View
I think you might need to elaborate on your question. The above code will generate a dictionary of derived values keyed by point location. If that is not what you need then please explain, clearly, what it is you are after.
GParkings
6-Sep-11 5:01am
View
I'm not sure i understand your comment. The above code is the C# equivalent of the MATLAB code in the link provided by the OP. It compiles and, to the best of my knowledge, does what the MATLAB code does.
GParkings
6-Sep-11 4:36am
View
The above code will not perform the behaviour you state. Instead it will return true for values of either "1" or "0" and false for everything else.
I believe what you were trying to achieve here was along the lines of
static bool ConvertToBoolean(string dataToParse)
{
return string.IsNullOrEmpty(dataToParse) ? false : dataToParse == "1";
}
GParkings
6-Sep-11 4:15am
View
Deleted
Thankyou for your feedback.
Yes, i Agree, in most cases you will be using more than one class for a namespace so aliasing the entire namespace would be clearer and leave tidier using declarations.
The point of aliasing a type in this tip was to demonstrate the level to which you can assign an alias.
GParkings
6-Sep-11 4:10am
View
to whoever voted 1: if you post a comment as to why you think badly of this solution i would be happy to amend it in order that any future readers of this question might be better served.
GParkings
5-Sep-11 17:23pm
View
haha, you beat me to that one :) have 5
GParkings
5-Sep-11 12:25pm
View
Haha, essentially the same olution posted at exactly the same time :D ... have a 5
GParkings
5-Sep-11 12:01pm
View
You describe your data model and your expected output but i cant see anywhere the code you are using to generate your XML output from your data model. As this is the bit of code that is not behaving as expected you will probably need to include it before anyone is able to help you
GParkings
5-Sep-11 9:14am
View
you would not believe how many times that one has caught me out :)
GParkings
5-Sep-11 6:27am
View
You are going to need to be a lot more specific here.
- what columns does your grid need?
- Where does the data come from?
Have you attempted the problem yourself? if so, what have you done and what problems did you encounter?
GParkings
5-Sep-11 5:54am
View
I think it would be best if you did the following:
- Do some research into generics (plenty of tutorials out there on the web) to make sure you understand what they are, why they are used, what limitations they have etc
- Talk to your mentor to clarify what exactly he wants you to do, it would appear you yourself are unsure of this and until YOU understand what you need to do we wont be able to either :)
Once thats done, have another go at it yourself and if there is a particular area on which you are having trouble submit a more concise question with regard to that. The large volume of code posted and the nature of the question being 'rewrite my code please' are off-putting to any would-be helpers.
GParkings
5-Sep-11 4:16am
View
please clarify what you want the new method signature to achieve.
your code line 1 seems fairly straight forward and i would expect such a method to apply tooltip text specified in the first argument (in your example the specified "" would clear the tooltip text) tot he control specified int he second argument.
your required method signature (code line 2) would have me seriously scratching my head as to what it actually DID as it takes 2 string arguments and no control argument, which string is the tooltip text and WHERE is the tooltip being shown?
GParkings
3-Sep-11 6:50am
View
griff is correct in that you should reconsider code design so as to not explicitly call event handlers. (the assumption here is that by function you mean the event handler method and not an instance of Func<t>)
EventArgs.Empty does exist, however : http://msdn.microsoft.com/en-us/library/system.eventargs.empty.aspx
GParkings
2-Sep-11 18:48pm
View
Deleted
nice, but personally i dont like adding performance overheads to save in typing, instead i would use a custom code snippet or macro.
GParkings
2-Sep-11 18:25pm
View
Deleted
Reason for my vote of 5
i didn't even know #error existed. I have always been concerned about notImplementeds getting released, i shall be using this approach in future.. i'll probobly snippet it in fact. many thanks
GParkings
2-Sep-11 17:50pm
View
Deleted
you appear to be missing a <t> from your class declaration and a <Person> from your instantiation.
other than that, very nice :)
GParkings
2-Sep-11 11:43am
View
that is the c# code :D . The comboBox control (here 'combobox' is the instance name of your combo box control) exposes a property called selected index, when that index is set it finds the entry within the combobox at that index (position) and selectes it. (positions start at 0 by the way).
When your application goes to display your form it first 'constructs' it, at which point the forms constructor method is called, and then displays it, at which point the load event is fired which executes the code in the load event handler. Therefore placing the above code in either of those 2 locations will cause the item within the combobox at the index (position) defined as n (in other words replace 'n' with a number) to be selected.
If you wish to only select an entry in the combobox when it has exactly 1 entry i its list of items you want:
if(combobox.Items.Count == 1)
{
combobox.SelectedIndex = 0;
}
which will select the first item if it is the only item
GParkings
2-Sep-11 7:49am
View
You should post some sample code in either an article or tips & tricks forum. Others would be interested to see how this can be done
GParkings
1-Sep-11 9:08am
View
Relectors such as those suggested below are very useful, but remember a lot of 3rd-party DLL licenses prohibit decompiling of the DLLs (and especially re-use of the revealed source code)
GParkings
1-Sep-11 9:06am
View
OR ... having re-read your symptoms:
the Zaber.Settings1.Default.nameX property getters are all returning the underlying field of Zaber.Settings1.Default.name6 (copy and paste error)
if that were the case, changing any other other property fields would appear to have no effect as the value returned for each would be the name6 value (i assume it has the same default as the other properties and therefore would give the appearance of no change), but changing name6 would mean that every nameX property returned the new value for name6
GParkings
1-Sep-11 9:03am
View
At what point have you verified Conversation.Device.DeviceNumber? was it at the point at which it is referred to within the switch statement? if it is correct at that point then stepping through the code line by line should confirm that the correct case is being entered (i can see no way in which that would not be the case).
Assuming that the above has been done then it is likely that either:
- something else is setting the Zaber.Settings1.Default.nameX properties
- This code is being unexpectedly run again (probably multiple times) and is setting the properties to the values you are seeing
- Zaber, Zaber.Settings1 or Zaber.Settings1.Default is being recreated and you are seeing the default (post instantiation) values
- your Zaber.Settings1.Default.nameX properties (I hope they are properties and not public fields) have incorrect setter code that is not actually setting their underlying field
GParkings
1-Sep-11 8:40am
View
are you perhaps after the instance name of the form instances?
if this is the case then take a look at Application.OpenForms
GParkings
1-Sep-11 7:20am
View
this will find a form by instance name, whereas Prerak's solution will find it by type name. I'm unsure what the OP requires.
Show More