|
Hello,
To make sure if your class is really ready for the GC, call GC.Collect() just for testing (Of course its not recomended to leave it in your code).
It could also be possible that the FormNetworking instance holds a connection too an other custom class (for example over an eventhandler), and so the GC will not clear the memory!
I also would recomend too check youre code with .Net MemoryProfiler (freeware).
All the best,
Martin
|
|
|
|
|
Can any Body tell me what is Bug Tacking System.
|
|
|
|
|
It's a system, right, for tracking ( are you still with me ? ), bugs.
In other words, it's something you could easily have googled for, or gone to wikipedia, it's a system that is used to keep track of known issues in your software, and when/how you fix them
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thankx for replying Christian Graus.
|
|
|
|
|
Hi boys & girls,
I would like to implement automatic updates to my application (which is in C#).
I’m quite confused, I heard that there is ClickOnce\ Updater Application Block built in .Net 2005, is it correct?
How do I use it?
Were can I find relevant tutorials?
In the MSDN site I could find only the Updater Application Block for .Net 2003
Thanks,
Gil
May the source be with you
|
|
|
|
|
I have been working on trying to write a directory watcher service.
One of the requirments is that it be able to watch multiple
directories, not sub directories of one parent directory, but just
multiple directories.
Using FileSystemWatcher in .Net
Thanks in Advance
Hari
|
|
|
|
|
well, I don't see the problem..
just use some a number of FileSystemWatcher objects..
life is study!!!
|
|
|
|
|
Hi You can do it creating Multiple FileSystemWatcher Objects.
Here is a code snippet of it.
//Folder to be monitered are placed in Appconfig seperated with ;
char[] delimiterChars = { ';' };
string FoldersNames = ConfigurationSettings.AppSettings["FoldersToMonitor"];
string[] fileNames = FoldersNames.Split(delimiterChars, System.StringSplitOptions.None);
foreach (string s in fileNames)
{
FileSystemWatcher Clientwatcher = new FileSystemWatcher();
Clientwatcher.Path = s;
Clientwatcher.Filter = "*";
Clientwatcher.NotifyFilter = NotifyFilters.LastAccess;
// Clientwatcher.Created += new FileSystemEventHandler(OnChanged);
Clientwatcher.Changed += new FileSystemEventHandler(OnChanged);
// Clientwatcher.Renamed += new RenamedEventHandler(OnRenamed);
Clientwatcher.EnableRaisingEvents = true;
fw.Add(Clientwatcher);
}
Enjoy.
Satya
|
|
|
|
|
Sorry forgot the declaration of fw. It's an arraylist.
ArrayList fw = new ArrayList();
Satya
|
|
|
|
|
Please see the following link. i think it will help you.
http://www.codeproject.com/useritems/AdvancedFileSystemWatcher.asp
asd
|
|
|
|
|
hi friends,
I had a problem , i am takin a survey in which i need to give value to the answers submitted by the user and take the average of it , please send me the solution
vinay
|
|
|
|
|
viru04 wrote: give value to the answers submitted by the user
We cannot help you with this unless you give some information on the type of answers.
viru04 wrote: take the average of it
Sum up the values and divide by the number of values.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
isn't that a mean
Russell
|
|
|
|
|
Hello,
In our firm, we use DataSet, DataTable, and Collectoin as Datasource for a DataGrid. But in 3 tier architecture I found that its slower when data is returned as a Collection Class from Data Layer, simply calling the Data Access function in the Data layer (which returns a DataTable) from Presentation layer is much faster. But this comes at the expense of breaking the architecture.
So which is the best data access object, Dataset (strongly typed or normal one), DataTable, or a Collection class? Can anybody share their thoughts.
Regards,
Blumen
Blumen
|
|
|
|
|
Hi,
I think is better to use datasets instead of collection because you can fill it directly from the adapter in the data access layer... You simplify... and you can do selects to get specific data from the table...
At last, I prefer dataset instead of datatable because If I need I can return two tables (and if is necessary I can use relations).
Thats my point of view. There're persons who prefer work with collections because they think that more easy to maintain...
|
|
|
|
|
il_masacratore wrote: Thats my point of view. There're persons who prefer work with collections because they think that more easy to maintain...
Not easier to maintain, but easier to work with in an OO fashion. Here's a quick example:
public interface IValid
{
bool IsValid { get ; }
}
public void ItemBase
{
protected virtual string TrimString(string value, maxLength)
{
if (value == null || value.Trim().Length == 0)
return value;
value = value.Trim();
if (value.Length > maxLength)
{
value = value.Substring(0, maxLength)
}
return value;
}
}
public void Customer : ItemBase, IValid
{
private string _forename;
private string _surname;
public Customer(string forename, string surname)
{
_forename = TrimString(forename, 30);
_surname = TrimString(surname, 30);
}
public string Forename
{
get { return _forename; }
set { _forename = TrimString(value, 30); }
}
public string Surname
{
get { return _surname; }
set { _surname = TrimString(value, 30); }
}
public bool IsValid
{
get
{
bool valid = false;
if (_forename != null && _forename.Trim().Length > 0)
valid = true;
return valid;
}
}
}
public abstract class BaseCollection<T> where T : IValid
{
private List<T> _list;
public List<T> Collection
{
get { return _list ; }
set { _list = value; }
}
public void Add(T value)
{
if (value.IsValid)
{
_list.Add(T);
}
else
{
throw new Exception("Invalid object.");
}
}
public abstract void Fill();
protected abstract void AddRow(IDataReader dr);
protected void Add(IDataReader dr)
{
if (dr.HasRows)
{
while (dr.Read())
{
AddRow(dr);
}
}
}
}
public class Customers : BaseCollection<Customer>
{
public override void Fill()
{
using (SqlConnection conn = new SqlConnection(Utilities.ConnectionString))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = conn;
cmd.CommandText = "GetAllCustomers";
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
{
Add(dr);
}
}
}
}
protected override void AddRow(IDataReader dr)
{
string forename = dr.GetString(dr.GetOrdinal("forename"));
string surname = dr.GetString(dr.GetOrdinal("surname"));
try
{
Add(new Customer(forename, surname));
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
Notice that you only have to implement the two methods in the inherited collection class to get the benefits of adding data from the database into your collection. It is trivial to extend this functionality to include the ability to search for records, save or delete them. Now, your client code will be a lot easier. Which of these do you think is easier to use?
customer.Surname = "Smith";
or
ds.Tables[0].Rows[0]["surname"] = "Smith";
What happens when you change the field name in the database from surname to cust_surname. In the implementation above, you only need to change this reference in the Customers class. If you are using a DataSet, then you have to hunt them down in every location that they are referred to and you could well end up missing them. Plus, what happens if you've exposed this as a web-service? The DataSet is a Microsoft implementation, so if a Java application is going to consume the DataSet then they are going to have to wrap up a heavy duty object. Plus, the renaming problem becomes much worse if you have changed the name of the column in the database. You are now asking everybody who consumes your DataSet to change their references to the field name. By the way, you can still bind the Collection property to items like a datagrid because this is a collection class.
I know that the abstraction seems to be a complete PITA, but once you have created a base object that you are happy with, you can easily reuse (and extend) this functionality. With the use of a tool like CodeSmith, creating the other classes becomes trivial.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I'm agree with you. But, at all, we're always depending on timing... In some cases we will do the best practices and in others we will do a shoddy work...
PD: If we use constants to access fields, we unify and we only have to change its value...
|
|
|
|
|
I agree that time constraints are a problem, but this is where a tool like CodeSmith comes into its own. We have a base set of objects that we have created and fine-tuned (for things like the base collections, the base item objects and so on). We then generate our standard stored procedures implementation classes and unit tests from this. This means that, once we have a data model defined, we can generate the entire DataLayer in one go.
Anything like validation that needs to be performed is handled in a derived class, so that if we regenerate the code, we don't lose our custom logic.
Yes, getting the base objects and CodeSmith templates into a fashion that you are happy with does take some time. But once you are happy with the way your objects work, generating new classes takes almost no time.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi again,
I will try it... You know any published example of use??
Thanks
|
|
|
|
|
Well, you can get the freeware version of CodeSmith (with templates) here. http://www.codesmithtools.com/freeware.aspx[^]. We have our own templates that have been developed and tested over a couple of years of seriously heavy duty use, but the standard templates are pretty decent. There is a thriving community of CodeSmith template writers on the web.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
In our company we return data from the data layer as lists of strongly typed objects, and testing has shown that this is around 20-30% faster than using data tables.
It's not really the performance that is most appealing, but the type safety. My experience is that it makes it much easier to write, debug and maintain the applications.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi,
I'm sorry to say this, but all these information got me confused. Pardon me, i'm a person with less than an year experience in programming.
Does all these posts mean collection are better. We already have implemented a part of our product using collections (3 tier), but its very slow and client now wants old VB 6.0 applicatio, it was lot faster...
I'm assigned this job to make a report on the reason of poor performance of our .NET application. When i used a datatable to return values from data layer to presentation layer, application was 70% faster.. The SQL query is fine, I tested it in Oracle..
Any ideas?
Blumen
|
|
|
|
|
Unfortunately it gets down to a question of experience and profiling. You need to look at how much data you are returning - are you pulling back more than you need to? What are you using to populate the collection? Are you using a DataReader to populate the collection, or are you using a DataSet/DataTable? Are you using web-services and passing data backwards and forwards between layers?
This last one is important because you need to serialize the data to pass over the wire (and then deserialize at the other end), and this serialization takes time. One of the commonest problems I have seen is people architecting systems using web-services when they don't need to.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
Thanks for the reply, I rally appreciate it. This is what we currently do:
1. From Presentation layer, we call a function in Business Layer and pass the business object to it.
2. From the business layer we pass this businees object received from step 1 to Data Access Layer.
3. In the Data Access layer we call the Oracle Stored Procedure.
In Step 2, we receive a Data as DataTable from Data Access layer. Here we convert it to a collection and send it to Presentation layer and this data collection is given as DataSource to the DataGrid. We use .NET Framework 1.1 SP1 with VS 2003.
We are in to health care domain, and in the above example you can consider the business object to be "Patient" in a hospital or a list of doctors or medecal history of a patient(s). This is the scenario we have at office.
I hope I'm more descriptive this time
But data retreival is pretty slow, once we Click the Search or Save button in a Windows Form, its takes some time before data appears in the Grid. And we have to refresh the data in the grid with user interaction (say when user changes doctor from the combo box), so that makes the application slower!
Considering the above situation, which data object would be best - Typed DataSet, normal DataSet, Collection, or DataTable.
Regards,
Blumen
I want to become a software consultant one day, a person who can solve any issues with design, architecture, and the application..
|
|
|
|
|