|
I'm an fairly experienced Java programmer who's just started on the road leading to C# & .NET.
I would like to know whether there's someobody who's had experience with the same. Is it an easy port? Does it take time or can you manage it fairly quickly? How does C# and especially .NET compare with Java? If you've programmed in Java before, or still are, what do you prefer?
Just curious...
Thanks
|
|
|
|
|
I never did any Java. But I can tell you this. The similarity ends with language syntax. As a Java guy you won't find C# mysterious. Just like how VB guys find VB.NET easy. And C++ guys find Managed C++ easy. But that's only 1/4 th the battle. The main challenge is understanding the .NET framework. The great thing about .NET is that the language or compiler does not really matter. That's just a matter of personal choice. Almost like the color of a motor car. The peformance does not depend on the car's color huh?
Nish
If I am awake and my eyes are closed, it does not necessarily mean that I am thinking of naked women.
|
|
|
|
|
|
Huh?
Nish
If I am awake and my eyes are closed, it does not necessarily mean that I am thinking of naked women.
|
|
|
|
|
Try the JUMP tool from microsofts MSDN site. It's a free to for Java User Migration Path (JUMP) and it is suppose to convert your code pretty well.
|
|
|
|
|
Who knows if it's possible to include some inline assembler code into C# code ?
|
|
|
|
|
Nope, it isn't possible. You could write a component in MC++ which contains the code then call it from C#, I believe the QuickStart samples have an example of how to do this [Edit: "this" refers to using MC++ to wrap some C/C++ code, the code you will wrap with MC++ is the ASM code].
James
Sonork: Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971
|
|
|
|
|
Just a few more posts and this forum will pass the ASP/ASP.NET forum
Yes, its a saturday night and i'm that bored.
James
Sonork: Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971
|
|
|
|
|
Do a little dance
Give a little love
Get down tonight
Next we conquer the VC++ forum!
James
Sonork: Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971
|
|
|
|
|
James T. Johnson wrote:
Next we conquer the VC++ forum!
[gives a quick look over shoulder as the metallic voices echo down the corridor]
Assimilate!
Assimilate!
Assimilate!
It's Saturday night & i'm amusing myself by cleaning whilst waiting for South Park to be on... I'd wager cash i'm more bored than you.
Sometimes i only remember, The days when i was young Nowadays no one remembers when they were young and stupid... ADEMA, The Way You Like It
|
|
|
|
|
Shog9 wrote:
i'm amusing myself by cleaning whilst waiting for South Park to be on... I'd wager cash i'm more bored than you.
I bet you are! I did the cleaning thing last Monday at 4am :-P
Now I'm rewriting/refactoring code for a directory splitter, hopefully the bug will be come more apparent now that I know what exactly will be needed in it
James
Sonork: Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971
|
|
|
|
|
James T. Johnson wrote:
Next we conquer the VC++ forum!
Wake up , wake up James.Your are just dreaming.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Nah, we just need to somehow break the VC++ forum and leave this one working
James
Sonork: Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971
|
|
|
|
|
When I ping certain servers, my lowest ping is like 25, the highest about 40. But, I got a package loss of 1.5%.
A package normally times out in about 2 seconds. But when I ping those servers, I KNOW that I won't recieve the package if I didn't get it in 40 ms.
I'm thinking about making a program that checks the data stream, calculates the average ping. The program 'knows' when a package will be lost, so it will send a new package after say 50 ms already. Then instead of a normal package loss the client will recieve a package in 50+30=80ms, which is still a great pingtime.
For normal browsing a package loss of 2 percent doesn't matter, for online gaming it does.
Does a program like this exist already?
If not, is my idea seriously flawed, or do you think it will work?
Feedback please.
Cheers!
|
|
|
|
|
Griffith Sutherns wrote:
If not, is my idea seriously flawed, or do you think it will work?
The major problem is that ping times can fluctuate greatly, even without dropping packets.
For an example, here at home we connect via cable modem to the internet. We have a D-Link 707 internet sharing router which serves as our gateway to the internet. Normally my ping times are about like yours, but if my dad starts uploading files they can quickly change from 25-40 to 500 to 700 for moderate uploading all the way up to 1500 to 2500 for extreme uploading.
Your scheme only works well in the case that i get a constant average ping. In my environment my ping can fluctuate wildly depending on what my dad is doing at the other end of the house.
In a game situation it would be a serious flaw to wait 2 seconds for a packet to be received. Most games factor in a little packet loss into the network design, either in passing redundant data across packets or in assuming that what is happening will continue to happen without that 1-2 packets of data. I believe Q3 uses the second method, which would explain why if you are really lagged you can continue to move, but you'll bounce around as the game gets the correct data.
My $.02 anyway,
James
Sonork: Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971
|
|
|
|
|
Of course, your connection has to be stable. I pinged some random servers, and with 30000 or so pings, the lowest and highest are less than 20 ms apart.
And if the program is a little smart, it will notice when the ping changes (upstream in other PC on LAN), so it will adjust the timeout settings.
I believe nothing like this is made so far, and I think it might work real well.
The program mainly avoids package loss on otherwise stable connections.
Thanks for you feedback, let's hope some more CPers will give their opinion.
|
|
|
|
|
While drawing in a double buffered control, how would one get a hold of the actual Bitmap that .NET is holding for the buffering? So you could set individual pixels for example. Aside from using yet another bitmap to do all of the drawing, which is what double buffering is doing in the first place.
Thanks
|
|
|
|
|
This is a double buffering code: (Its from Beginnning C# books by wrox publisher).Maybe it helps you:
Graphics displayGraphics = e.Graphics;
Random r = new Random();
Image i = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);
Graphics g = Graphics.FromImage(i);
g.FillRectangle(Brushes.White, ClientRectangle);
for (int x = 0; x < ClientRectangle.Width; x++)
{
for (int y = 0; y < ClientRectangle.Height; y += 10)
{
Color c = Color.FromArgb (r.Next(255), r.Next(255),
r.Next(255));
Pen p = new Pen(c, 1);
g.DrawLine(p, new Point(0, 0), new Point(x, y));
p.Dispose();
}
}
displayGraphics.DrawImage(i, ClientRectangle);
i.Dispose();
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
While I appreciate the answer, please read the question before answering it…
The .NET Control already has the ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint styles set, which provides double buffering for the control.
As a mater a fact, I am already doing something like what you posted (on top of double buffering) to get to any kind of SetPixel method.
What I would like to know is if I can get a hold of the bitmap .NET already has, for the double buffering I told it to do?
Thanks
|
|
|
|
|
Neil Van Note wrote:
While I appreciate the answer, please read the question before answering it…
Ok,I'll do it.
Neil Van Note wrote:
The .NET Control already has the ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint styles set, which provides double buffering for the control.
I didn't know this one,thanks.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
I looked through the docs and nothing obvious stuck out at me. I even tried doing some p/invoke but got nowhere.
It looks like you can't get the underlying bitmap unless you create it yourself
James
Sonork: Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971
|
|
|
|
|
That’s what I found, I was hopping I was wrong...
So this leads be to my second question. Is there a method that I am not seeing, that will allow me to set an individual pixel, other than those of the Bitmap’s?
I am already creating a Bitmap to achieve this, I was just hopping there was a more direct method. Again, nothing in the documentation is jumping out at me.
Thanks
|
|
|
|
|
Nothing directly unfortunately, you might be able to use DrawLine to simulate it.
It really looks like GDI+ (ie the System.Drawing namespace) was meant for higher level operations.
You can make a call out to gdi32.dll with p/invoke, but that could possibly be a real performance drag. I'll come up with a sample and compare the results of p/invoke and Bitmap.SetPixel
James
Sonork: Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971
|
|
|
|
|
>> "you might be able to use DrawLine to simulate it"
Haaa, if it comes down to that, I'll stick with the Bitmap, the performance is actually pretty good considering I am keeping it around for the life of the control.
P/Invoke can be a good and bad thing, the number of Sets are numerous and again, I would rather use the extra Bitmap, than to call out to SetPixelV 1000 times.
I would be curious to see what your performance test show.
Regards
|
|
|
|
|
I've created a benchmark program, VS.NET project and batch file provided to compile it.
GDIvsGraphics.zip
James
Sonork: Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971
|
|
|
|