|
C#, while theoretically faster than Java (due to being 'designed for JIT compiling')
I love how Redmond constantly tries to imply that JIT compilation is their bright idea. Java had JIT compilers long before the .NET brand was being marketed to the world. The execution speed of Java code, according to an IBM study, is about 1.7 times slower than equivalent Fortran code. Deep compilers, similar to ngen.exe for .NET, exist for Java and work well.
JIT compilation doesn't really say anything about the runtime speed of code, by the way. A good JIT compiler will compile code that runs faster than the output of a worse compiler. JIT compilation does, however, introduce some unavoidable slowness when something is first run, due of course to the compilation time required.
I implemented several applications side-by-side in C# and Java a while back, and they ran neck-and-neck on my setup. Java is faster in some respects, and .NET is a little faster in others.
I agree with everything you wrote except that; chalk this post up to having too much time on my hands on a Sunday afternoon.
Regards,
Jeff Varszegi
|
|
|
|
|
I did say 'theoretically', eh? Yes, Java has had JIT compiling for awhile I know, however, Java is more or less an interpreted language out of the box, with some so-called 'hot spot' JIT compilation as needed.
Yes, Java and C# are very close performance wise. I'd be willing to bet, though, that as C# matures, .NET will eventually outpeform Java evidently as the great compiler teams at Microsoft focus their brilliant brain-heads on it.
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
The "HotSpot" compiler is just the name brand for Sun's compiler, which many people don't even prefer to use. All of the major compilers in use today are JIT compilers. "More or less interpreted" is a phrase that applies exactly as much to .NET as it does to Java.
There are also "brilliant brain-heads" at work trying to make Java run faster all the time. Every version has included speed improvements, just as is true between version 1.0 and 1.1 of .NET. I wouldn't be willing to bet that .NET will outperform Java eventually, because they're way too similar, and there's no magic. As they both creep more and more towards optimal implementations, their performance will probably become closer to identical.
I'm not arguing just to argue, but I wouldn't bet that Microsoft stuff will kick ass just because of the brand.
Regards,
Jeff Varszegi
EEEP!
|
|
|
|
|
Have a look at Purple# too. They have a project hosted on SourceForge.
|
|
|
|
|
Chers everybody for ansering my questions. It has become less foggy when thinking in C#, I will explore the OpenGL Potensials and also look at Managed DirectX.
Marcus Grenängen MO Software Sweden
|
|
|
|
|
I'm trying to create a Tree data structure whose externally revealed methods and properties will behave much like the System.Windows.Forms.TreeView. I noticed something strange, and I'm not sure how one would go about doing it. It could just be that I'm missing something simple, however.
You can do the following...
<br />
TreeView tv = new TreeView();<br />
tv.Name = "My TreeView";<br />
TreeNode tn1 = new TreeNode("1");<br />
TreeNode tn2 = new TreeNode("2");<br />
tv.Nodes.Add(tn1);<br />
tv.Nodes[0].Nodes.Add(tn2);<br />
<br />
MessageBox.Show(tv.Nodes[0].TreeView.Name + "; "<br />
+ tv.Nodes[0].Nodes[0].Parent.Text);<br />
The result will be "My TreeView; 1". Which means that tn1 knows that its parent TreeView is tv1, and tn2 knows that its parent TreeNode is tn1. This is weird, because nowhere did I tell tn1 about tv1, or tn2 about tn1, and the Parent and TreeView properties are read only.
Does anyone know how they did this? Or how I might go about mimicing them?
|
|
|
|
|
First of all, the TreeView encapsulates the Tree-View common control, the very same native controls that comprise Windows Explorer and many more applications - the same with most of the Windows Forms Controls. The TreeNode encapsulates the TVI_* messages for the Tree-View common control.
If you plan on doing this yourself, then your tree nodes keep a collection of other tree nodes. When a tree node is inserted into the collection, you assign private or internal properties (depending on your object model) that set both the parent node and the container (like the TreeView ). For tree views that don't encapsulate native controls (and define a tree view from scratch), this is generally what's done, like the UltraWinTree from Infragistics[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am having a problem with the Directory package. I need to create a list of a root directory and all of the sub-directories associated with that root. I am currently using the System.IO.Directory.GetDirectories(_PathName) to get a list of the first level of subdirectories. This returnes a string array of the subdirectories. Now i need to go anothers step down and check all of these subdirectories for additional subdirectories. The problem is that i could do this but i am not quite sure how to extend this for an unknown amount of levels within the directroy structure. Any help would be appreciated.
Thanks
|
|
|
|
|
Hi
this is a code i use to copy a directory tree..
and I readthe directory tree..(The same as your program)
read it and get the idea
private void cmdCopy_Click(object sender, System.EventArgs e)<br />
{<br />
if(!Directory.Exists(txtDist.Text))<br />
{<br />
MessageBox.Show("Please enter a valid path");<br />
return;<br />
}<br />
DirectoryInfo dir=new DirectoryInfo(txtSrc.Text);<br />
CopyDirectory(txtSrc.Text,txtDist.Text+"\\"+dir.Name);<br />
MessageBox.Show("OK");<br />
}<br />
<br />
private void CopyDirectory(string src,string dist)<br />
{<br />
if(!Directory.Exists(dist))<br />
Directory.CreateDirectory(dist);<br />
<br />
FileInfo file;<br />
DirectoryInfo dir;<br />
string[] strFiles;<br />
string[] strDirs;<br />
<br />
strFiles=Directory.GetFiles(src);<br />
foreach (string strFile in strFiles)<br />
{<br />
file=new FileInfo(strFile);<br />
file.CopyTo(dist+"\\"+file.Name);<br />
}<br />
<br />
strDirs=Directory.GetDirectories(src);<br />
foreach (string strDir in strDirs)<br />
{<br />
dir=new DirectoryInfo(strDir);<br />
if(dir.FullName==dist)
continue;<br />
CopyDirectory(dir.FullName,dist+"\\"+dir.Name);<br />
}<br />
}
|
|
|
|
|
Does anybody know of a way when developing your own VS.NET add-in, to access all the server connections? What I want to do is grab all the tables from the databases listed in their and place them on a treeview in my addin.
I know its not the best place to post this, but there is no "CRAZY QUESTION YOU WOULD ASK WHEN WRITING AN ADD IN FOR VS.NET" forum is there guys? (blush)
Ta!
Nursey
|
|
|
|
|
Hi,
I made 2 custom controls, both of which have a default constructor. The problem is that when I try to drag one of them into the form from the toolbox, I get a message saying that an exception occured while trying to create an instance of the control. The exception text is "Object reference was not set to an instance of an object."
Now with the other control, it works Ok when I drag it onto the form and works as expected when I run the program, however if I try to delete it from the form I also get an "Object reference was not set to an instance of an object." exception.
Can you please help me locate the source of this error?
Thanks for your help.
Josef
|
|
|
|
|
Problems found and fixed.
Thanks,
Josef
|
|
|
|
|
hi, am trying to load values from config file in windows service project installer but it fails to load, then i tried to load that config file using xmldom, it worked but in this way installer looks for the file in system32 directory rather than in my installation directory.
How can i do that
|
|
|
|
|
The application's .config file is read from the same directory as the application executing your installer - not the installer itself. So, if you use the installutil.exe, then installutil.exe.config is used from the same directory where installutil.exe is executed (not the current working directory).
You should typically not use .config files with installers for this reason - your installer class is typically contained in a DLL and executed by something else. Instead, accept command-line parameters which make it more flexible, easy to document (see the Installer.HelpText virtual property), and easy to use even with Windows Installer packages (which you can pass properties as command-line parameters.
See the Installer.Context property documentation in the .NET Framework SDK for more information and an example of how to get those properties from the installer's context.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi
i`m new user in code project
my name is hmd
i want your help ..
1 - who can sending data bitween client , server by using
xml form.
I `m wating ......
thank you
|
|
|
|
|
hmdhmd wrote:
who can sending data bitween client , server by using
xml form.
Anyone, however if you have a specific question, try asking that.
- Nick Parker My Blog | My Articles
|
|
|
|
|
I cant find this error in the msdn help file. Wanted to know if anyone had a clue on what it was. Arxopia-En is a DLL that compiles and has a few string resources in it. This is just a snip of the code but it is the only part of the code that uses the RM atm. Do i need to provide more info, just cant seem to figure out the meaning of this error.
Assembly generation -- Referenced assembly 'Arxopia-EN' is a localized satellite assembly
<br />
namespace HammackJ.Arxopia.Engine<br />
{<br />
using System;<br />
using System.Resources;<br />
using System.Reflection;<br />
using System.Text;<br />
using Arxopia;<br />
using Arxopia.Resources;
<br />
public class Menu<br />
{<br />
ResourceManager rm;<br />
<br />
public Menu()<br />
{<br />
rm = new ResourceManager("Arxopia.Resources.Arxopia_En.GameStrings", Assembly.GetAssembly(typeof(Arxopia.Resources.Arxopia_En)));<br />
<br />
}<br />
}<br />
<br />
|
|
|
|
|
You can't explicitly reference satellite assemblies - Fusion does this automatically.
The satellite assemblies contain localized values (text or binary data encoded as text, typically using base64) for information in your primary assembly. So, if you create a new ResourceManager against, say, a Form derivative then a .resources embedded resource is used (if available) to find those localized resources. If the current Thread.CurrentUICulture</code. is different or you pass a specific <code>CultureInfo to something like ResourceManager.GetString or ResourceManager.GetObject , then a corresponding satellite assembly is searched for and loaded if available, otherwise the resources in your primary assembly - the neutral language resources - are used (or a culture-independent language, if available). This lookup can be avoided for neutral resources if you use the NeutralResourcesLanguageAttribute and set that to your culture-specific language which you use for the primary assembly (like I would use "en-US"). This can boost performance when using localized resource classes like the ResourceManager .
See Resources in Applications[^] in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks a ton again sir. I had En in the [assembly: AssemblyCulture("")] tag in the assemblyinfo.cs. Now it complies correctly.
Again thank you for your help.
-hammackj
|
|
|
|
|
You also shouldn't name your assembly with "EN" in the name, if you did that. Make sure you read that link I gave you. Your assembly name should be something simple, like MyCompany.MyProduct or something, and includes the neutral resources. If that's "en-US", then no satallite assemblies would need to be loaded but you still don't name your primary assembly with culture identification - it's just not proper and your satallite assemblies become oddly named an confusing.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
how to make a chat program one server multi client by c#
note that :
each client can talk with the server only.
all clients can send and receive to/from server .
sameer
|
|
|
|
|
This can be very simply done using web services.
You can create web service with method for sending messages and method for geting content of chat window.
You can store messages on server in database or simply in memory or xml file.
Also creating client that uses web services is simple.
You can see tutorial about using web services here http://samples.gotdotnet.com/quickstart/aspplus/doc/webservicesintro.aspx[^].
|
|
|
|
|
.NET Remoting over a TcpChannel would be even better, however. Using XML Web Services forces the chat clients to poll for new messages, while a .NET Remoting object that exposed events could notify - it not send - the new messages to the clients immediately.
Since Web Services uses HTTP for the transport channel, they are bound by the HTTP protocol which is stateless and one-way by nature.
See the article, Applying Observer Pattern in .NET Remoting[^] for a decent example.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You are right.
Using web services for more complex chat application isn't good way, but I think that solution with web services is good enough for simple chating application (if there are only few users). And I tought that azhar ( I'm not sure with name) wants something more simple.
|
|
|
|
|
Web Services really don't make things any simpler, though. Remember that if you poll for messages, the server has to keep track of messages since the last time the client polled, and the clients - even a relatively small number of them - won't poll at the same time so the message queue would have to be associated with each client or you'd have to implement some algorithm where you keep track of the number of clients connected and clear the queue after that many requests for messages. With that, you have to worry about abnormal client termination to decrement that count.
With .NET Remoting, the message just gets broadcast to the connected clients and that's it. .NET Remoting isn't nearly as hard as many think it is.
Microsoft MVP, Visual C#
My Articles
|
|
|
|