|
Rahul.P.Menon wrote:
But it really seems bad for powerful language like C# always depend on dotnet frame work.
Why?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Rahul,
Your statement is roughly analagous to saying:
"It seems bad for this lovely suede bucket seat to depend upon an engine, steering wheel, suspension, wheels, chassis and drive train to get around." Without the mechanical parts, there is no car no matter how lovely and soft the seat is (provided your last name isn't Flintstone).
The language is a tool for combining and expressing the contents of the framework in interesting or useful ways (or in completely boring or silly ways - makes no difference). It might be considered nothing more than a convenience or abstraction to save developers the time it would take to write IL directly, and that's really all it amounts to - semantic games to keep developers working and off Prozac.
Without the framework, C# or any of the other .Net languages would have little of the power they now offer in terms of rapid development. They would lack (among other things) a type system and a runtime environment - CLR and CTS are both considered parts of the framework. For giggles, imagine coding an application without any of the types in mscorlib.dll some time.
It might be easier to think in framework-centric terms. The framework is the necessary part of any managed code solution; the language is the variable/disposable part - it matters least.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Hai,
Whatever you told is right.If a car engine is specific for particular wheel or a particular chasis or steering how we can say that we can depend on that car engine.If the car engine functions independendent of other things , a person can use accessories he like.
C++,VB,Java are using independantly to develop stand applications. Like that why C# alone is not using to develop applications.But C# is using with dotnet to develop application.
If the csc.exe compiler can compile C# program ,Can it use alone to develop applications.
I know using dotnet tool it is easy and rapid to make applications.So developing application without tool is out of scope and not necessary.Only because of this C# is not trying to use alone.
Because of my anxiety I raised these queries,so that I can correct my wrong I deas and aquire much information.Thank you very much for all the help and information provided.
Thank You,
Rahul.P.Menon
SoftwareDeveloper(.NET)
|
|
|
|
|
Rahul.P.Menon wrote:
C++,VB,Java are using independantly to develop stand applications.
Each of these is no different than C# or VB.NET or Managed C++.
Wrong. They all have their own run-time environments. Java is the closest cousin to the .NET Framework. The compilers for C++, C#, and VB.NET are built into the .NET Framework, exctly like Java's compiler is built into it's framework environment.
C# is just as "stand alone" as anything else...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
It is powerful because it DOES depend on the .NET framework, as do C++.NET and VB.NET. Java depends just as greatly on the JRE, the only difference is terminology.
VB6 might be just a little more independent, but you could say that it depends on the Windows framework (system DLLs), they just happen to come with the operating system.
I can write a program in PowerBuilder 9 and compile it, but I must make sure the user has PBVM90.DLL and LIBJCC.DLL on the path for that executable. And if I want use Datawindows, PBDWE90.DLL. And if I want to use an ODBC database, PBODB90.DLL and PBODB90.INI. (The list goes on...) Those are PowerBuilder's "framework", although they don't call it that.
The advantage with C# (and C++ and VB) .NET is that you (the developer) don't have to worry about the framework being on the path, windows handles that for you. The user can install the .NET framework from the web, and you can just give them your EXE file. (Or whatever you developed).
Perhaps you are confused about the difference between the .NET framework and Visual Studio .NET? Your users don't have to have Visual Studio, they only need the .NET runtime, which is freely downloadable from Micorsoft.com.
|
|
|
|
|
look at the lines:
double x = double.MaxValue;
double y = double.MaxValue;
double what = (x+y)-y;
if c# select the double operator+(double,double), then what should be "PositiveInfinity"; but it is double.MaxValue!
Why does this happen? Is there a
decimal operator + (double,double)?
If there is, then there should be no " double operator +(double,double)".
Who knows the fact? Please help. Thanks.
|
|
|
|
|
I think that the compiler optimizes x+y-y to x.
---
b { font-weight: normal; }
|
|
|
|
|
nope.
(x+y)-y got the same result.
|
|
|
|
|
Here is the compiled code:
x = double.MaxValue;<br />
<br />
00000020 mov dword ptr [ebp-10h],0FFFFFFFFh<br />
00000027 mov dword ptr [ebp-0Ch],7FEFFFFFh<br />
<br />
y = double.MaxValue;<br />
<br />
0000002e mov dword ptr [ebp-18h],0FFFFFFFFh<br />
00000035 mov dword ptr [ebp-14h],7FEFFFFFh<br />
<br />
z = x + y - y;<br />
<br />
0000003c fld qword ptr [ebp-10h]<br />
0000003f fadd qword ptr [ebp-18h]<br />
00000042 fsub qword ptr [ebp-18h]<br />
00000045 fstp qword ptr [ebp-20h]
The actual calculation is done in the FPU, storing the result of the first calculation internally. It looks like the datatype used internally can handle larger values than a double, as the result of the calculation is correct.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I have a windows form application that works well in my computer in debug and release modes from IDE and windows explorer. I do XCOPY deployment on other computer. When I run the applicaiton there, it gives System.TypeInitialization exception.
As expected, this exception is thrown when I call a class with only public static variables...no constructors, propterties and methods.
How can I solve this issue?? Please help me
Cheers
CNU
|
|
|
|
|
This may seem stupid, but it's the most common mistake with XCOPY deployment. Did you make sure you copied all the .DLL files in the bin folder to the applications deployment folder? Did you reference some other assembly that's registered in the GAC on the development machine, but is not deployed to the target machine?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I solved that problem...and you are absolutely right.
One of the dll files used has CopyLocal value set to false. It worked in my system as the dll was copied to GAC.
Thanks a lot for your help.
|
|
|
|
|
No problem!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have written an AVLTree class and I was doing some benchmarking using System.Collections.Hashtable as a comparison. And I was surprised by the results. (I am self-taught and so I never had a college level data structures class so please excuse my ignorance.) I did an insert of 1,000,000 random integers into each (using System.Random with a maximum of 10,000,000) followed by 100,000 random (using System.Random with a maximum of 1,000,000) key searches on each. Each time the results were pretty much as follows:
AVLTree test:
Inserts: 951625 - Height: 23
Time: 10:435 sec - Memory: 45.892 KB
Hashtable test:
Inserts: 951803
Time: 4:977 - Memory: 46.723 KB
AVL lookup performance test
Found: 9514 - Time: 350 ms
Hashtable lookkup performance test
Found: 9422 - Time: 70 ms
I tried both Hashtable.ContainsKey and Hashtable.Item with the same "lookup" results. The only thing that seems to vary is that sometimes the Hashtable doesn't use up so much memory (I've seen as low as 32 KB).
I even ran ANTS Profiler on my code to improve the data structure's performance. But I don't see where I could squeeze out another 6 seconds on inserts and while 350 ms isn't anything to laugh at it's much more than 70 ms.
I thought that trees were super efficient data structures used for high speed updates/queries and large amounts of data. (I know this isn't the only application for trees but this is the problem I'm looking to solve). Based on what I had read I decided to put the time in to learn about trees and implement one in a scenario at work where I needed high performance.
So my question is, "When would I want to use a tree instead of a hashtable for heavy data indexing?". I may be a rookie on this one but I'm not proud so I would be happy to send the code in question to anyone interested in my question.
|
|
|
|
|
IMO Hashtables are best for this type of thing. Trees are better if you need partial matches.
One reason why Hashtable runs so fast, it has a native runtime implementation, so even if you duplicate the C# code for it, it will probably be 2-3 times slower.
I have run some benchmarks on a Blowfish implementation i did. Quite suprising results.
C#: 5MB/s
C# optimized: 12MB/s
MC++ optimized managed: 35MB/s
MC++ optimized mixed: 45MB/s
You can squeeze alot of speed using some native code.
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
leppie wrote:
IMO Hashtables are best for this type of thing. Trees are better if you need partial matches.
By partial matches do you mean multi-column keys like in a database index? Or even breaking up a key into segments like you might do for an IP address?
leppie wrote:
One reason why Hashtable runs so fast, it has a native runtime implementation
Based on what you say, it makes sense that a hashtable would be faster because of native code, but I'm also interested in why a hashtable would be better in a general sense.
|
|
|
|
|
|
Thanks,
I appreciate the feedback.
|
|
|
|
|
leppie wrote:
it has a native runtime implementation
Probably Im misunderstanding you but I think thats not correct. Ive used Reflector and the HashTable implementation seems to be completely managed.
|
|
|
|
|
I need someone to point me into a direction.
I need to be able to accomplish the following ( request/response ):
1) send an xml document to an ip address and a specific port
2) listen for the response document also an XML document.
Upon recieving the request document the connection is broken imediately.
After the XML server is ready to return the reply document, a new connection is
established using an address supplied with the orginal request.
BTW I am new to sockets so please be patient with me.
Things I need to do?
1) open socket to server and steam the xml request doc to the server.
2) Listen and capture the response document and write it to disk.
|
|
|
|
|
Take a look at the MSDN docs for the Socket[^] class and its members. They provide many code examples which should give you a starting point.
www.troschuetz.de
|
|
|
|
|
Hi there!
I am trying to save different .swf files on my local machine.
Actually this is already working with the below code.
Unfortunately (how I already figured while writing the code) The file is saved, but somehow corrupted.
Is there maybe a way more simple way to get the Response of an URI into a string (or, let's say a buffer) and save it on my disk?
Below is the code I came up with (within a C# web application):
// init
bool debug = false;
// this is where I get my test-swf, you can have a look at it at:
// http://www.styte.com/3.swf
// it may look strange, what I am trying to do is to read some php-created
// swf's into my .net application....
string url = "http://www.styte.com/trans.php?&bild=3.swf";
// work
Uri fileUrl = new Uri(url);
// Create 'FileWebrequest' object with specified Uri.
WebRequest myFileWebRequest = (WebRequest)WebRequest.Create(fileUrl);
// Send 'FileWebRequest' object & wait for response.
WebResponse myFileWebResponse = (WebResponse)myFileWebRequest.GetResponse();
// Get stream object associated with response object.
Stream receiveStream = myFileWebResponse.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("windows-1252"); //("utf-8");
// Pipe stream to higher level stream reader with req. encoding format.
StreamReader readStream = new StreamReader (receiveStream, encode);
if (debug==true) Response.Write("\r\nResponse stream received ");
int numChars = 1;
Char[] read = new Char[numChars];
// Read "numChars" characters at a time.
int count = readStream.Read ( read, 0, numChars );
if (debug==true) Response.Write("(count): "+count.ToString()+" File Data...\r\n");
//Response.ContentType = "application/x-shockwave-flash";
//Response.AddHeader("Content-Type", "application/x-shockwave-flash");
FileStream fs = File.Create(@"C:\Inetpub\wwwroot\leilac\uploads\test.swf");
BinaryWriter bw = new BinaryWriter(fs);
while (count > 0) {
String str = new String(read, 0, count);
bw.Write(str);
Response.Write(str);
count = readStream.Read(read, 0, numChars);
}
bw.Close(); fs.Close();
if (debug==true) Response.Write(" ");
// Release resources of stream & response object.
readStream.Close();
myFileWebResponse.Close();
Response.End();
Appreciate any comments/help.
Sasch, styte, http://www.styte.com/
|
|
|
|
|
I believe that you should skip the encoding.
---
b { font-weight: normal; }
|
|
|
|
|
Hey Guffa!
Hmmm, I was thinking about that from the beginning, but how to do so?
S.
|
|
|
|
|
sascho wrote:
Encoding encode = System.Text.Encoding.GetEncoding("windows-1252"); //("utf-8");
// Pipe stream to higher level stream reader with req. encoding format.
StreamReader readStream = new StreamReader (receiveStream, encode);
if (debug==true) Response.Write("\r\nResponse stream received
");
Instead of using a StreamReader, have you tried using a BinaryReader[^]? You don't have to specify an Encoding with it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|