|
You asked this in the C# and VB.NET forums. your code is VB. Please don't cross post.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Could not get any help from there?
r00d0034@yahoo.com
|
|
|
|
|
imran_rafique wrote: Could not get any help from there?
If you can't get help in the VB forum, why do you think you'll fare any better in the C# forum?
|
|
|
|
|
How to convert long type to twodimensionalarray conversion
for example
private long nP;
public long giveNewPolygs(ref PointF[][] newP)
{
long n;
try
{
n = p[0].Length;
n = p.Length - 1;
}
catch (Exception ex)
{
return -1;
}
newP = nP;
newP = p;
return n;
}
|
|
|
|
|
The real question is, how do you WANT to turn a single number into a 2D array of points ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
really i dont understand that answer.
please give me the correct code conversion for array[][] to long.
|
|
|
|
|
I am speechless.
I can convert a single long into a 2D array any number of ways. There is no actual, obvious conversion. Therefore, you need to explain yourself better, because the odds are that if I make up an answer, I will answer the question, without helping you. Is the long a pointer to an array, is that the problem ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
What do you actually want to do here?
Manoj
Never Gives up
|
|
|
|
|
This is my code part. In here i want the conversion for newP = nP;
private long nP;
public long giveNewPolygs(ref PointF[][] newP)
{
long n;
try
{
n = p[0].Length;
n = p.Length - 1;
}
catch (Exception ex)
{
return -1;
}
newP = nP;
newP = p;
return n;
}
|
|
|
|
|
There is no such conversion predefined, and there is no obvious way of constructing a conversion like that.
What is your idea about what a conversion like that would do? For any given example value, what would you expect the result to be?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Good luck - he stopped answering when I asked the same thing.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello everyone,
Will this way faster if I need to supply CultureInfo, compared with calling CultureInfo.CurrentCulture each time?
1. using a static member CultureInfo, and retrieve only once using CultureInfo.CurrentCulture;
2. when need to supply CultureInfo, provide the static member reference.
thanks in advance,
George
|
|
|
|
|
Have you tried timing it yourself?
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
Not yet, just ask for general advice or better ideas here.
Do you have any ideas?
regards,
George
|
|
|
|
|
George_George wrote: Not yet, just ask for general advice or better ideas here.
The best thing you can do is try things out for yourself before asking. This will enable you to sift answers for yourself, and to evaluate what works and what doesn't. More importantly, you shouldn't rely on people giving you the right answers for many reasons (in no particular order):
They mightn't have understood your problem.
Language issues.
Their information is based on old behaviour that has long been superseded.
They plain got the wrong end of the stick in the first place.
They are just yanking your chain.
They really don't know.
They have only given you part of the picture because they expect you to get the rest for yourself.
You've posted a lot of questions in the past month or so which you could have answered yourself with a well constructed example. Why not try things out for yourself and then post for clarifications on points you don't understand - oh, and buy a book.
|
|
|
|
|
I really wanted to give the answer that they would be the same, but after checking, I found some surprising results. Here is the timing code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Globalization;
namespace CultureInfoKata {
class Program {
static void Main(string[] args) {
Stopwatch st = new Stopwatch();
CultureInfo info = CultureInfo.CurrentCulture;
Int64 iterations = 10000000;
Int32 trials = 20;
TimeSpan rAverage = TimeSpan.Zero;
TimeSpan sAverage = TimeSpan.Zero;
for (int j = 0; j < trials; j++) {
Console.WriteLine("***************************************");
Console.WriteLine("Starting iteration {0}", j.ToString());
st.Start();
for (int i = 0; i < iterations; i++) {
String.Format(info, "Text");
}
st.Stop();
rAverage += st.Elapsed;
Console.WriteLine(st.Elapsed.ToString());
st.Reset();
st.Start();
for (int i = 0; i < iterations; i++) {
String.Format(CultureInfo.CurrentCulture, "Text");
}
st.Stop();
sAverage += st.Elapsed;
Console.WriteLine(st.Elapsed.ToString());
}
Console.WriteLine("***************************************");
Console.WriteLine("Overall Results:");
Console.WriteLine("Using object reference:{0}", TimeSpan.FromMilliseconds(rAverage.TotalMilliseconds / (Double)trials).ToString());
Console.WriteLine("Using static reference:{0}", TimeSpan.FromMilliseconds(sAverage.TotalMilliseconds / (Double)trials).ToString());
Console.ReadLine();
}
}
}
And here are the results:
***************************************
Starting iteration 0
00:00:02.4918791
00:00:02.6975864
***************************************
Starting iteration 1
00:00:05.1777309
00:00:02.7060980
***************************************
Starting iteration 2
00:00:05.1796692
00:00:02.6850936
***************************************
Starting iteration 3
00:00:05.1637124
00:00:02.6671581
***************************************
Starting iteration 4
00:00:05.1498686
00:00:02.7091927
***************************************
Starting iteration 5
00:00:05.2085886
00:00:02.7085847
***************************************
Starting iteration 6
00:00:05.1934733
00:00:02.7077047
***************************************
Starting iteration 7
00:00:05.2302492
00:00:02.7350313
***************************************
Starting iteration 8
00:00:05.2383390
00:00:02.8166922
***************************************
Starting iteration 9
00:00:05.3049657
00:00:02.6893061
***************************************
Starting iteration 10
00:00:05.1531035
00:00:02.6684418
***************************************
Starting iteration 11
00:00:05.1420193
00:00:02.6652652
***************************************
Starting iteration 12
00:00:05.1462953
00:00:02.6682994
***************************************
Starting iteration 13
00:00:05.1606059
00:00:02.7505680
***************************************
Starting iteration 14
00:00:05.4113100
00:00:02.7220753
***************************************
Starting iteration 15
00:00:05.2402528
00:00:02.7108708
***************************************
Starting iteration 16
00:00:05.2144905
00:00:02.7059263
***************************************
Starting iteration 17
00:00:05.1762065
00:00:02.6729379
***************************************
Starting iteration 18
00:00:05.1473431
00:00:02.7072361
***************************************
Starting iteration 19
00:00:05.2706150
00:00:02.8438043
***************************************
Overall Results:
Using object reference:00:00:05.0700000
Using static reference:00:00:02.7120000
I'm not sure how the results from trial 0 end up being different right off hand, I'd have to have a closer look. But it seems that using the static reference is generally faster in this test presuming I've not misused or taken for granted some aspect of the testing code. I'll run my profiler on it and get back with more results.
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
The profiler gave different results than the Stopwatch() timing. I think I'd have to agree with the profiler. Who knows what's going on with the the timing in the code to give results like that.
Here's what ANTS says:
Over 200000 iterations total times were
0.556 (sec.) String.Format(info, "Text");
0.638 (sec.) String.Format(CultureInfo.CurrentCulture, "Text");
So they're about the same.
For this version, I changed the reference to the object to point to a new instance
CultureInfo info = new CultureInfo(CultureInfo.CurrentCulture.LCID); .
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
Thanks carbon_golem,
Could you let me know what do you mean the Profiler please?
regards,
George
|
|
|
|
|
My front end is in asp.net which will call a method from dll which is in C# .In my C# dll i want to call a method from another dll which is in C.In my main page pageload event i call a function foo() from C# DLL which inturns call foobar() from another DLL which is in C. how can i do this ?i really want to know how to give refrence of C dll in C# dll.
Please provide me any usefull link or some small sample code for this.
any help appreciated .
Thanks in advance.
|
|
|
|
|
cristi_alonso wrote: ?i really want to know how to give refrence of C dll in C# dll.
p/invoke
www/pinvoke.net[^] has many examples
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
The link you gave is not working .tell me how to do this by PI/invoke?
|
|
|
|
|
i'm creating my very first app, as apparently I have to start refering to myself as a programmer. problem is that i feel like i'm in over my head.
the app im working on need to pass two tables into text files, then from the Form open BeyondCompare to check differences betwixt the tow tables.
my current problem is that of composite formatting.
as i'm passing the tables into text files it would make sence to still make sence of the content within the text files as any discrepacies will need to be investigated.
how do i use composite formatting to space the columns and rows from a DataTable correctly in a text file?
can anyone help please hey
-Klop-
|
|
|
|
|
I have no idea what you're talking about. If you have a datatable, I would expect an Environment.NewLine between lines of text, and that's about it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
never used Environment.NewLine
what i want to achieve is to space the columns in the text files so that it looks like a datatable, this is to make it easy for a person to see where exactly a discrepancy between the two databases is. and report the correct changes to dbadmin
|
|
|
|
|
hi all,
i want to do a login form using workflow in c#,
please help me to design WF at this form....
thanks alot
|
|
|
|