|
Eddy Vluggen wrote: What are you trying to achieve
He is trying to achieve trolldom and succeeding very well.
|
|
|
|
|
None of the values are constant and the comparisons are not valid because the two systems are different. One system may be faster than the other under these tests, but that does not prove anything. And finally, if you want more information on these figures then go and discuss it with the person who published them.
Use the best guess
|
|
|
|
|
crunchor wrote: Check out the replies over there of one of my posts. OK, I have looked and it seems that you need to spend more time learning what is appropriate for each forum.
Use the best guess
|
|
|
|
|
crunchor wrote: how can this java faster than c# result happen? "Overhead"; Ubuntu is a bit smaller, doesn't load as much on start. No side-by-side executables, no DEP, no WPF/Aero, no ActiveX. All the stuff that we pay for to avoid using Ubuntu
It'll also depend on the benchmark, and the quality of the implementation of the Mandelbrot in Java and C# - are they both as good as possible, or is one of them written while drunk? I assume you DO recognize all the algorithms used to test the systems?
Sorry, but I didn't see any surprises in the graph. What you can see is that .NET is faster than Java on Windows (what a surprise) and that Java is faster than .NET on Linux (again, expected).
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
My main concern is how can java+linux faster than C#+windows, very likely in the same server with same testing script just written in different language.
|
|
|
|
|
crunchor wrote: with same testing script just written in different language. That makes them different scripts; one might be more efficient than the other.
crunchor wrote: how can java+linux faster than C#+windows They're different OS'es, running different software; you didn't expect them to be equally fast, did you?
Like I said, Windows loads more. Try comparing Ubuntu to DSL, and there'll be another difference in speed; even when using MySQL and PHP on both, there'll be a difference in speed. Why? Because Ubuntu loads more background-services than DSL.
One doesn't choose a platform based on a few seconds difference in speed in a specific algo; server-performance is broader than the speed of a specific algo. Think of it this way; a webserver doesn't compute the Fibonacci every minute, it'd be more helped with a good caching-strategy.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You are comparing apples and oranges here. You might as well ask which is faster, a cabbage or the complete works of Shakespeare?
The issue has nothing to do with the language, and everything to do with the operating system. That's what you should be looking at.
|
|
|
|
|
Pete O'Hanlon wrote: You might as well ask which is faster, a cabbage or the complete works of Shakespeare?
Why, the cabbage of course...
(sorry Pete, couldn't resist, I'll go back into hiding now)
|
|
|
|
|
Actually, ask any teenager who has to study Shakespeare and they'll tell you they can throw the Shakespeare further and faster than they throw the cabbage.
|
|
|
|
|
Fundamentally, as others have pointed out, Linux is less bloated/feature rich* than Windows. If you test c++ under Linux and Windows, Linux is pretty much going to win. Why? Because Linux is doing less in the background,
Run java and c# on windows, c# wins: The JVM slows java down. Even without this MS will probably optimise .net and Windows against eachother, so without this factor you'd hope .net wins.
I've heard if you run Mono (a port of .net) on Linux against Java, Java wins. Why, I don't know I've never used mono. Probably mono is less optimised (it is a tiny project compared to Java). I don't even know how mono compiles.
The comparison you mention changes all the varibles, so it isn't a true test of the efficiencies of each framework.It does tell you, for speed Java on Linux wins over .net on Windows, but nothing about the relative efficiency of the two frameworks directly.
*Delete according to your prejudices
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
crunchor wrote: how can this java faster than c# result happen?
The vast majority of professional programmers shouldn't care even if there was a real difference.
That is because professionals deal with application performance driven by business needs. And in the vast majority of cases the performance of that has nothing to do with a specific technology.
And that includes the lack of ability is gathering requirements, managing expectations, focusing on real business needs, architecture, design and developer implementation skill level.
|
|
|
|
|
Hi every one
I know it may seem strange but I am using a web service inside a lan for my project. The service written by Visual Studio C# as a WCF project. I have added the service reference to my clients and they can easily call methods in the web service.
Now, the IP of the server hosting the web service is able to be changed, and when It changes, the service is not callable any more.
I plan to find a way to eliminate calling the web service using "service reference" in client and want to place an external txt or xml file to contain the URL of web service so that I can change it when the ip address of the web service changed.
What is the way to call a wcf base web service without hard coding the service reference in the design time?!
I appreciate any help
|
|
|
|
|
|
Over the project I created several classes and enum's; I hope it's bit self-explanatory:
public enum weaponType{unarmed, dagger, sword, club, axe};
public enum monsterType{ rat, bat, humanoid, feline, beast };
class weapon : item
{
private weaponType type;
public weaponType Type
{
get { return type; }
set { type = value; }
}
private int requiredSkill;
public int RequiredSkill
{
get { return requiredSkill; }
set { requiredSkill = value; }
}
...
}
class actor
{
private name;
public Name{ get{return name; } set { name = value;} }
...
private int daggerSkill;
public int DaggerSkill { get{return name; } set { name = value;} }
private int swordSkill;
...
}
class monster : actor
{
private monsterType;
...
}
class player : actor
{
private ratKills...
}
"Actors" need to have all the "weaponType-Skills" additionally, the player needs to have all the "monsterType-Kills" as separate properties.
However, I would like to freely add and remove items from those enum's without much overhead; because the overhead would increase exponentially if the project becomes more complex.
So what I rather like to do is the compiler to iterate through the enum and generate all the extra properties like "Skill" and "Kills" dynamically and to be able to use them as if they're fully written out.
So far I haven't been able to figure out how, or if, this can be done programmatically; without resorting to make some code generator.
As usual, any help is much appreciated.
.
|
|
|
|
|
So why not use a List<string> for the skills. For example:
public class actor
{
private List<string> skills = new List<string>();
public bool HasSkill(string skill)
{
return skills.Contains(skill);
}
public void AddSkill(string skill)
{
skills.Add(skill);
}
public void RemoveSkill(string skill)
{
skills.Remove(skill);
}
}
Etc... That way you don't have to modify the system to add skills, it just works.
Is there a way to generate classes and properties dynamically? Yes, but its really not easy, requires use of low level MSIL and some pretty good knowledge of CodeDOM, really more of a headache than its worth.
|
|
|
|
|
Thanks for your reply.
I can't use that because Skills will be integers.
But you gave me the idea to use an array instead. It would look something like this: int[skillType.Length - 1].
It's indeed good enough and still pretty easy to make.
I've done some assembler in the past, but I don't know MSIL. I was hoping there's some function in the .NET library that could do it; but I couldn't find it.
.
|
|
|
|
|
Its because it's not there, it would be nice to be able to add properties to a type at runtime but you can't. You can generate them dynamically, but you have to generate the entire class (although you could use derived classes for base functionality).
There are other things you can do dynamically, such as anonymous types, but I don't think they would fit the bill since you have to know all the properties at instantiation. Instead of using an array of integers, you can also use an array of your skill enum. That way you don't have to type cast later and you can extend just by adding elements to your enum. Another way would be to add the Flags attribute to your enum, then you can combine flags, like:
enum Skills { skill1, skill2, skill3, skill4 }
private Skills mySkills = Skills.skill1 | Skills.skill2;
You can then use the Skills.HasFlag to determine if any of the flags (skills) are set.
|
|
|
|
|
I think a Dictionary<string,int> would be more appropriate. This way you can save the skills of your player object to disc and reload them later, even after you have added more possible skills. You could of course also use an enum as key instead of the string as suggested.
|
|
|
|
|
Been working on this for two days now, so it's a bit too troublesome to go back and review the core after I got it all working. I'm indeed using enum's as a key to translate raw csv into useful game data.
The downside is that making some changes like removing or switching around items may indeed break existing game-files, but it's not a big issue since everything else scales just fine.
Not expecting this will become a problem though. I'll put a version tag on everthing just in case.
.
|
|
|
|
|
In a C# 2010 desktop application, I want to change the application so that it will only allow users to select a
report that meets the following criteria:
1. part of the file name is "ErrorReport" and
2. The last node of the file name is .xlsx or .xls.
So far I have the following code:
string[] excelFiles = Directory.GetFiles(strDirectoryLoc, "*ErrorReport*")
.Select(path => Path.GetFileName(path))
.Where(x => (x.EndsWith(".xlsx") || x.EndsWith(".xls"))
&& (!x.StartsWith("~")))
.ToArray();
This code works when I am selecting only excel (*.xls or *.xlsx) files.
The problem occurs if the user selects a .pdf file iniitally and there is actually a file in the directory path
that meets the criteria I listed above. The code will ignore the .pdf file the user selects and will actually use the
excel file that is in the directory path.
Thus how can I change the code listed above to say the .pdf file is invalid?
|
|
|
|
|
I think you are looking for something like:
string[] excelFiles = Directory.GetFiles(strDirectoryLoc, "*ErrorReport*")
.Select(path => Path.GetFileName(path))
.Where(x => (x.EndsWith(".xlsx") || x.EndsWith(".xls"))
&& (!x.StartsWith("~") && x.Contains("ErrorReport")))
.ToArray();
You can also use Path.GetFilenameWithoutExtension and check that the string has ErrorReport in it.
|
|
|
|
|
Is there such a thing as 2 way events? OR maybe I am doing this wrong. My form is making a call to a dll to submit a form and logon to a web site if required. The dll all of a sudden needs more information that wasn't thought it would need prior so it wants to ask the user for more information and then continue when it has it. I have searched around for 2 way events with no luck. I started to make an event that calls back to the form and then the form calls back with the new information to a continuation event but then I started to realize that there are issues with this such as another function called the logon function and the form doesn't know about that. Obviously I could track that as well. In any event I would like to know if I am doing it the wrong way.
|
|
|
|
|
Events are always "2 way", meaning they are raised and returned.
Maybe you are getting terms mixed up, you don't call functions by using events (or if you are, its not the right design). You should have a way of validating your user input before pushing up the call stack to the DLL to make sure you get everything you need.
Can you give a specific scenario? Here's how it reads to me:
Your application asks me for some information, like username/password. I give it. You pass it to the DLL to submit some information to a web-site and this DLL needs additional information to complete the call, like saying "not registered, please create an account". You need the additional account information so you ask the user for it and call again.
In that case, I would expect that the DLL function returns something that says it needs more data. You simply ask the user for it, and re-submit to the same function. If you are subscribing to an event in the DLL that says "succeeded" "failed", or "additional info" then it really is a violation of programming principles since how are you supposed to match up a function call with a request if you have multiple happening at the same time?
I guess I would need more information to be able to suggest a good course of action here, is the DLL yours or third party?
|
|
|
|
|
Well in this case it's a captcha. So I don't know if it will even be required for 1 and 2 I need the user to solve it.
|
|
|
|
|
Events are alwyas "2 way", though they are never described as such.
There is always an event provider and one or more subscribers to that event. The event usually passes the source of the event (usually as Object) and some kind of EventArgs object. What you may not realize is that you can modify the Eventargs object passed to your event handler. When the event handler code goes out of scope, the event provider gets control back and can look at the data that is in the EventArgs object it sent to the handler. For an example of this, see Form_Closing and it's FormClosingEventArgs class. In there, you'll find a Cancel property that the handler code can set to cancel the form being closed.
Another example is KeyPressEventArgs and its Handled property.
|
|
|
|