|
ting668 wrote:
However, is there any rules to divide the code?
Yes:
1. When something is reused, it goes to a DLL.
2. When something needs to hide classes, data and references to other DLLs, it goes to a DLL. E.g., Data Access Layers - we have a rule where no project but the DAL should use a SqlConnection or an OracleConnection. When classes or data need to be hidden, but public to an assembly, we use the 'internal' keywork and put it on a DLL.
3. When the project is mature (i.e., we're on the optimization phase) and something is slow to load, and will not be used on the application startup, it goes to a DLL.
Yes, even I am blogging now!
|
|
|
|
|
you only use dlls if you wanna reuse that specific code and share it among more than one program and the rules varry depending on how you want the dll to be used you may for instance want to make some sort of graphics dll with might include several classes or you may just want a single class in your dll such as a simple custom control that you share between a few programs. they are also usefull if you want to update only specific portions of your software without updating the entire release. sometimes it may just be simpler to contain all your code within a single .exe file as it makes installtion easier becuase dlls need to be registered with the os and the more seperate compenents your program has to deal with the greater potential for error/corruption as well as problems with updating a dll and breaking the code in your exe known as "DLL HELL". i hope this helps
|
|
|
|
|
|
Yes, right!
What is the simplest installer for .NET?
-> Ctrl-C Ctrl-V
|
|
|
|
|
heyas all,
pretty simple question I would imagine...
<br />
static void Main(string[] args)<br />
{ <br />
int input = Console.ReadLine();<br />
<br />
whatTime(input);<br />
}<br />
Where the prototype for whatTime is:
public string[] whatTime(int);
How would I get this to work? I tried an explicit cast, but it didn't
like that neither.
help please?
thanks all!
"There are 10 types of people in this world; Those that know binary and those that do not."
|
|
|
|
|
Int32 has a Parse method that takes a string parameter or you can use the ToInt32 method of the System.Convert class.
Both will throw a FormatException if the string cannot be parsed (including empty strings), or an OverflowException if the value is < Int32.MinValue or > Int32.MaxValue . Int32.Parse will throw an ArgumentNullException if a null value is passed, whereas Convert.ToInt32 will return 0.
Charlie
if(!curlies){ return; }
|
|
|
|
|
ahh perfect, thanks charlie!
"There are 10 types of people in this world; Those that know binary and those that do not."
|
|
|
|
|
is .net assembly quicker than assembly i doubt it but im still having thoughts..
IM PROUD TO BE A GMAIL;
|
|
|
|
|
Theoretically, it could be, as ASM code would be fixed for a single machine and use profile, while .NET IL code could auto-adjust to conditions on machine that would be detected on application startup.
In practice, .NET IL code is several times slower (tipically 5~100 times) than hand-made ASM code.
Yes, even I am blogging now!
|
|
|
|
|
Even in theory i don't think that it could be. Out of interest what is your argument for that?
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
The standard arguments for that are, that the JIT could build asm code specific to the hardware the program is running on, like processor architecture, cache size and even transfer some calculations to the graphic card etc...
But I also think this will never happen, because the JIT would have to be 100x more intelligent than the best c compilers of today.
|
|
|
|
|
The two are very different actually. It wouldn't be fair to compare. Do a little research. If i had some time i would explain.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
...
I have 3 questions for the page break experts out...
...
When you develop very complex and large programs with thousands and thousands of functions and classes, at a certain point the page will actually become far to large or filled to write anymore code and you are prevented.
1.? Will a page break solve this problem?
2.? If yes to 1. then how do I put in a page break in so that this will not be a problem?
3.? If yes to 2. then is there code at the end of the 1st page and the beginning of the second page that would be required?
Thanks to any and all experts who answer!
demasoni.com
As we traverse through this thing called life with recursive thoughts we must allways beware of the pointers that will ultimately leave us dangling from a string on the end of a tree branch. ->
Elite ->
|
|
|
|
|
woah 1000's of functions, what are you creating an operating system?!?!
anyways if you mean by page braking like put seperate sources in seperate files then definatly since i have never witnessed 1000's of functions but surely everything will be a mess + the ide will probably take a long time to load the whole document
IM PROUD TO BE A GMAIL;
|
|
|
|
|
No, not separate files. All in one single file. I need everything in one single file for now. Later I will may break it up into smaller header files if possible but I want it in one file for now.
I need a way to actually break the page where you type the code in the IDE of C#. It should look like two or more pages somewhat like typing several pages in Word Perfect assuming that it is possible to do it in C# version MDE2002. I am not even sure if it will allow you to continue typing if you could break the code area into several pages but I would like to know for sure. Somewhere around 40,000 or 50,000 lines of code C# prevents you from typing anymore and I need many many more, 1000's of lines of code to complete the functions and classes that I need.
It is not an OS, but a very very complex calculus based mathematical piece of software with thousands of methods seperate from each other such that it requires it. An OS probably has millions of lines of code. I have seen GUI EXE files that are several megs in size so it is not uncommon for huge file sizes with tens of thousands of lines of code. Mine only has tens of thousands.
So, is there anybody with an answer for the following...
...
I have 3 questions for the page break experts out...
...
When you develop very complex and large programs with thousands and thousands of functions and classes, at a certain point the page will actually become far to large or filled to write anymore code and you are prevented.
1.? Will a page break solve this problem?
2.? If yes to 1. then how do I put in a page break in so that this will not be a problem?
3.? If yes to 2. then is there code at the end of the 1st page and the beginning of the second page that would be required?
Thanks to any and all experts who answer!
demasoni.com
As we traverse through this thing called life with recursive thoughts we must allways beware of the pointers that will ultimately leave us dangling from a string on the end of a tree branch. ->
Elite ->
|
|
|
|
|
What do you mean by "page break"? Are you printing your code?
No matter what one may argue, a long method or a long class is a bad practice: it can always be shorter. Actually, by making it shorter, often you'll find lots of bugs in it.
Don't do a "page break", whatever you meant by it: reduce the size of your code.
Yes, even I am blogging now!
|
|
|
|
|
yeah your best option would be seperate your code into individual files thats the best programing practice you can follow. seperate your program in a logical manner not only is it easier on the compiler but its also easier to navigate and use overall as far as i know there is no way to insert a page break thats a word processor thing
|
|
|
|
|
My "IDE" can handle roughly 600 000 lines but thats purely a GDI+ limitation, and I have been too lazy to work around it.
My suggestion is to generate the file, but make it abstract/virtual, compile to DLL, then load that assembly in your IDE, and inherit from the class.
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
600000 lines are not enough four you?
Are you crazy?
Am I getting insane?
|
|
|
|
|
Insanity and genius are merely a mirror image of each other.
I have written many projects that easily run into the tens of thousands of lines of code. Most who do that very easily are developing very complex programs or even creating new technologies, like I am, that are not even on the market.
I would feel that most of us who are creating new technologies are in the genius/insanity class. We should all be experts at cutting the code to an absolute minimum. A lot of the times you are limited by the compiler and the computer. IMO todays PC computers are "extremely" pathetic for processor power and speed. I have very easily pushed the envolope on a 2.4 ghz pentium and a gig of 800 mhz RIMS for the exe file. We need a supercomputer in a laptop instead of that that cheesy plastic box of copper and silicon they call a computer. Even my desktop with the hot ram, cpu, and SCSI drives is what I consider a flibber.
JMO, anyway.
Thanks so very much for all of you helping out with your answers.
demasoni.com
As we traverse through this thing called life with recursive thoughts we must allways beware of the pointers that will ultimately leave us dangling from a string on the end of a tree branch. ->
Elite ->
|
|
|
|
|
I am having trouble executing my files on my pda after successful execution in .net 2002. I am getting the typeloadexception error and just can't figure it out! The entire error reads:
TypeLoadException
Could not load type
System.Windows.Forms.Form from
assembly System.Windows.Forms,
Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089
Hopefully a simple download or something will fix me. Thanks!
|
|
|
|
|
I would like to place a colored rectangle around whatever control has focus on the form. I have seen this done in C++ using a "Hook" method, but I want to do it in C# and was hoping someone could help me get started or knew of something similar.
Thanks
|
|
|
|
|
The only thing I can think of - in the form constructor, after InitializeComponent(); add loop for attaching to all controls on form event handler for Enter event. The same event handler for all controls, and in this event invoke repaint function in any way.
Robin Panther
|
|
|
|
|
I am writing a small program that using WMI to get windows security logs. The programm suppose to get 50 logs each time and dump them into a text file, then stop.
Currently, my code can start to collect logs, but never stop.
Could anyone tell me how to do this? I tried to modify the WMI query, but it seems the WMI query has very limited functions.
Thank you very much.
----------------------------------------------------------------------------
using System;<br />
using System.Management;<br />
using System.IO; <br />
<br />
class Sample_ManagementEventWatcher<br />
{<br />
[STAThread]<br />
public static int Main(string[] args)<br />
{<br />
<br />
StreamWriter SW;<br />
SW=File.CreateText("logs.txt");<br />
SW.Close();<br />
<br />
MyHandler mh;<br />
EventArrivedEventHandler eventArrivedEventHandler;<br />
ManagementEventWatcher watcher;<br />
string comp = "servername";<br />
mh = new MyHandler();<br />
eventArrivedEventHandler = new EventArrivedEventHandler(mh.Arrived);<br />
watcher = Sample_ManagementEventWatcher.getWatcher(comp);<br />
<br />
watcher.EventArrived += eventArrivedEventHandler;<br />
<br />
watcher.Start();<br />
<br />
Console.WriteLine("Watcher is running, press <enter> to stop...");<br />
Console.ReadLine();<br />
watcher.Stop();<br />
<br />
watcher.EventArrived -= eventArrivedEventHandler;<br />
<br />
return 0;<br />
}<br />
<br />
public static ManagementEventWatcher getWatcher(string comp)<br />
{<br />
ConnectionOptions co;<br />
ManagementPath mp;<br />
ManagementScope ms;<br />
WqlEventQuery EventQuery;<br />
ManagementEventWatcher watcher;<br />
string wql;<br />
string wqlAnd;<br />
<br />
<br />
<br />
co = new ConnectionOptions();<br />
co.Timeout = new TimeSpan(0, 0, 60);<br />
co.EnablePrivileges = true;<br />
<br />
mp = new ManagementPath();<br />
mp.NamespacePath = @"\root\cimv2";<br />
mp.Server = comp;<br />
ms = new ManagementScope(mp, co);<br />
wqlAnd = " AND TargetInstance.Logfile ='Security'";<br />
<br />
wql = "select * from __instancecreationevent where targetinstance isa 'Win32_NTLogEvent'" + wqlAnd;<br />
EventQuery = new WqlEventQuery(wql);<br />
<br />
watcher = new ManagementEventWatcher(ms, EventQuery);<br />
<br />
return watcher;<br />
}<br />
<br />
public class MyHandler<br />
{<br />
public void Arrived(object sender, EventArrivedEventArgs e)<br />
{<br />
ManagementBaseObject mbo =<br />
(ManagementBaseObject)e.NewEvent["TargetInstance"];<br />
Console.WriteLine(mbo.GetText(0));<br />
<br />
StreamWriter SW;<br />
SW=File.AppendText("logs.txt");<br />
SW.WriteLine(mbo.GetText(0));<br />
SW.Close();<br />
<br />
}<br />
}<br />
<br />
}
|
|
|
|
|
Hi! I want to know how to move buttons inside a windows form. I tried in some ways, but nothing..
People said me to use drag&drop property but I think it is not the right way.. Can someone give me a hand? If it is not to ask too much, could you write me the code?
Thanks a lot!
|
|
|
|