|
ihoecken wrote: By the way, I didn't downvote you and I wonder why someone did.
I've just counter-voted, but I have a suspicion as to why he was univoted.
|
|
|
|
|
I'd disapprove it because it uses recursion where none is necessary. But that's just me.
|
|
|
|
|
Well, that's the effect of how we're taught recursion in schools and colleges - using examples where recursion is unnecessary (e.g. finding the factorial of a number).
|
|
|
|
|
I know. I know.
And were I teaching it I'd have to do the same, but I'd then show the iterative alternative.
"Recursion is a very powerful programming technique that is best avoided whenever possible."
|
|
|
|
|
I still it funny that when recursion is taught in school they may just touch on the the effect this has on the stack, or even what the stack is!
Then all the noobs are scratching their heads when they see "Stack Overflow" errors.
|
|
|
|
|
if you are trying to determine the number of digits, this will not work;
sum += (int)(bigInteger % 10);
What you need is:
sum++;
What you had was the sum of the digits, not the number of digits. I cannot understand why somebody wants the sum of digits, really does not tell you anything usefull. The number of digits does.
|
|
|
|
|
Actually I didn't want to count the digits. I wanted to sum the digits and I did.
As I said that website is full of Problems that their purpose is practicing.
They doesn't need to make sense.
|
|
|
|
|
Two thread concurrently
but in a certain state of thread A need to wait the process result from thread B
how can i do it???
|
|
|
|
|
You can call the Join method family which you'll find here[^]. This means of course that thread A, the thread that wants to wait for thread B, must have access to the thread B instance, so it can call the Join() method on it.
Regards,
— Manfred
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
Thanks a lot Manfred R.Bihy
|
|
|
|
|
I am creating a List of structure like:
List<MyNS.Graph.XY_AXIS> Axis = new List<MyNS.Graph.XY_AXIS>(); but I need to create array of such object dynamically.
I am new to C# so got stuck.Please guide .
|
|
|
|
|
How dynamic do you want it?
List<MyNS.Graph.XY_AXIS> Axis = new List<MyNS.Graph.XY_AXIS>();
Axis.Add(X,Y);
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks but I need array of Axis. I need to create an array of List say 10, each List element will be object of class. How to do that?
|
|
|
|
|
Use the ToArray() method of the list after you added all the items.
|
|
|
|
|
john5632 wrote: I need to create array of such object
You question is ambiguous. An array of the list or an array out of the list?
If you want to create an array of the list, you can probably use a List of List like this:
List<List<MyNS.Graph.XY_AXIS>> Axis = new List<List<MyNS.Graph.XY_AXIS>>();
If you wish to create an array out of the list, then use:
MyNS.Graph.XY_AXIS[] axisArray = Axis.ToArray();
|
|
|
|
|
Hello CP,
I've run into a problem while working on an interface for the result of raw SQL.
The user inputs the raw SQL code and the form renders a result, it's an educational piece of software so nothing too fancy.
Now, the problem I have is that after putting the result into a DataTable, it crashes when I pass it as a DataSource for the DataGridView.
The database I'm querying is an MSAccess (2003, mdb) database.
Oddly enough, it doesn't misbehave (crash) when I'm using an SQLite database.
I would like some help since the stacktrace isn't making sense to me.
Quote: A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll
System.Transactions Critical: 0 : <tracerecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" severity="Critical"><traceidentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled<description>Unhandled exception<appdomain>SimpelQL.Net.vshost.exe<exception><exceptiontype>System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089<message>Parameter is not valid.<stacktrace> at System.Drawing.Font.GetHeight(Graphics graphics)
at System.Drawing.Font.GetHeight()
at System.Drawing.Font.get_Height()
at System.Windows.Forms.DataGridViewRow..ctor()
at System.Windows.Forms.DataGridView.get_RowTemplateClone()
at System.Windows.Forms.DataGridView.RefreshRows(Boolean scrollIntoView)
at System.Windows.Forms.DataGridView.RefreshColumnsAndRows()
at System.Windows.Forms.DataGridView.OnDataSourceChanged(EventArgs e)
at System.Windows.Forms.DataGridView.set_DataSource(Object value)
at Proj.Net.MainForm.evt_Exec(Object sender, EventArgs e) in L:\Dev\Proj.Net\MainForm.cs:line 139
The first rule of CListCtrl is you do not talk about CListCtrl - kornman
|
|
|
|
|
Do you have a custom paint-handler? Any other event that is triggered on a refresh, using Fonts?
Cover the lot with breakpoints, and show us some code
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I went a whole lot simpler and it's still throwing exceptions.
private void frm_Shown(object sender, EventArgs e)
{
DataTable t = new DataTable();
t.Columns.Add("a");
t.Columns.Add("b");
t.Rows.Add("a","b");
System.Diagnostics.Debug.Assert(t.IsInitialized == true);
dataGridView1.DataSource = t;
}
I have no idea why this is bugging.
The first rule of CListCtrl is you do not talk about CListCtrl - kornman
|
|
|
|
|
I do; this is not all code. You've prolly got drawing-events assigned, check out what happens if you put them into comments. Or paste enough code to reproduce the problem on the board
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
In a C# 2008 console application, I need to send doucments to a web service. This is marked with the following xml: subDocuments attachmentId="xx3">.
I need to send word documents, excel spreadsheets, and PDF files back to the web serivce. Can you tell me how I would accomplish this goal using code?
The xml that I need to generate along with the documents is listed below:
<ns2:RetsubPack serviceSuccessful="true" returnCode="0" xmlns:ns2="http://test1/test">
<statusDescription>Package Details retrieved Successfully</statusDescription>
<PackageDetails>
<Type>type2</Type>
<Category>dog</Category>
<ContName>Co 1</ContgName>
<TotalTrans>0</TotalTrans>
</PackageDetails>
<NumberOfDocuments>3</NumberOfDocuments>
<subDocuments attachmentId="xx1">
<DocumentMetadata>
<DocumentTypeCode>Spreadsheet1</DocumentTypeCode>
<PackageId>pkg1</PackageId>
</DocumentMetadata>
</subDocuments>
<subDocuments attachmentId="xx2">
<DocumentMetadata>
<DocumentTypeCode>Spreadsheet2</DocumentTypeCode>
<PackageId>pkg1</PackageId>
</DocumentMetadata>
</subDocuments>
<subDocuments attachmentId="xx3">
|
|
|
|
|
Perhaps if you could be much more specific with your question. Exactly what is it that you're having trouble with?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I do not know how or where to get started at.
|
|
|
|
|
Start by investigating webservices. Create a basic one from a tutorial and work from there.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi, I saw many open source programming projects but many of them are hard for the first time. Do you know any resources for my need?
|
|
|
|
|
atoi_powered wrote: many of them are hard for the first time
You should then be focusing on smaller projects that fit your skill level. Why not work on your own small projects that you feel confident in doing, and as you progress, add some advanced ideas.
There are plenty of articles around here that you can start to get some ideas. What topics in programming are you interested in?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|