|
The problem is when GC is not necessarily, I also have to use it.
Just too rich.
More local variables mean higher cohensive
Less function parameters mean looser coupling
|
|
|
|
|
If you don't like the garbage collector, then program in a none-managed language and manage all your memory requirements yourself. Then you'll come to know and love the GC.
|
|
|
|
|
I'm programming using C++ now, and sure that GC is very good when I need it.
More local variables mean higher cohensive
Less function parameters mean looser coupling
|
|
|
|
|
If the GC really isn't necessary for your usage scenario, then its won't spent any time collecting, and will run less frequently. If you think the GC is causing a problem in your program, then I suggest you first tell us what the ".Net Memory\% time spent in GC" performance counter reads.
The only performance bottlenecks I have seen in real world applications in my consulting role is due to poor programming (usually by people thinking they can do a better job than the experts).
|
|
|
|
|
If a specific part of the application has a real time demand, it'll be better if GC can be diabled
temporally.
I've just read it in MSDN, there are latency modes for it.
It survives.
More local variables mean higher cohensive
Less function parameters mean looser coupling
modified on Thursday, September 25, 2008 7:41 AM
|
|
|
|
|
If the application really has a realtime demand then you run it on a real time OS.
You shouldn't be considering doing anything in .Net if the slight interruptions of the GC are going to be an issue. There are plenty of other things that can interrupt execution on that platform.
|
|
|
|
|
No it's not. But Eiffel, for example, has per thread garbage collection. Problem is it has miniscule industry use.
Kevin
|
|
|
|
|
Can I disable auto garbage collection in .Net?
system
|
|
|
|
|
Nope. If you did, you'd run out of memory VERY quickly.
|
|
|
|
|
I was using a project for months, no problem.
Something changed 3 days ago in my project. Now it won't compile/run.
It complains that every class in App_Code folder doesn't exist. They worked fine before.
The files exist. The folder exists.
I rename the Utilities.vb file and create a new one. Still says class undefined.
I started a new Web App. Right-click on project->Add->Folder->App_Code (since the menu item App_Code isn't an option)
Add a class to App_Code. I notice the Build Action is Compile.
Switch back to 1st project. None of the classes are set to Compile. Okay, change that, Run.
Now, it Builds the project, but the web server complains the classes are AMBIGUOUS. Make up your bloody mind.
Compiler Error Message: BC30175: class 'Utilities' and class 'Utilities', declared in 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\2d7f8030\4e18611d\App_Code.idisyg3r.3.vb', conflict in namespace '<Default>'.
Source Error:
Line 9: Imports CrystalDecisions.CrystalReports.Engine
Line 10:
Line 11: Public Class Utilities
Line 12: Public Shared Function GetAuthenticationTypes() As IDictionary
Line 13: Dim mySortedList As IDictionary = New SortedList()
After 3 days of beating my head in, I realize my renamed class which is Excluded from the project, but still in the folder, is causing this. I delete it.
Why on Earth would Studio interpret a class Excluded from the project just cause it's in the folder?
And how did all my classes get set to Content, not Compile?
Cheetah. Ferret. Gonads. What more can I say? - Pete O'Hanlon
|
|
|
|
|
i'm not positive about this, but it would appear that the IDE doesn't compile your web application, the asp.net compiler does; and it likes to compile everything in the web directory, whether it is part of your project or not
|
|
|
|
|
Hi,
I am creating a windows application in which i have got a DataGridView containing some comboboxes and checkboxes. Is there a way to fill the DataGridView from the database. Now i am filling the datagrid cell by cell seperately. Also there exist problem while updating the database. I am giving my code with this. Will anyone help me out of this.
1 public void LoadData(int tabcnt)
2 {
3 string module = this.tabControl1.SelectedTab.Text.Trim();
4
5 string connString;
6
7 string query = "";
8
9 connString = ConfigurationSettings.AppSettings.Get("ProjDB").ToString().Trim();
10
11 if (module != "")
12 {
13 query = "SELECT * FROM Module_Requirements where Module='" + module + "'";
14 }
15 else
16 {
17 MessageBox.Show("There Is No Modules", "No Modules", MessageBoxButtons.OK, MessageBoxIcon.Information);
18 }
19
20 dAdapter = new MySqlDataAdapter(query, connString);
21
22 MySqlCommandBuilder cBuilder = new MySqlCommandBuilder(dAdapter);
23
24 DataSet ds = new DataSet();
25
26 ds.Clear();
27
28 try
29 {
30 dAdapter.Fill(ds);
31 BindingSource bSource = new BindingSource();
32 }
33 catch (Exception ex)
34 {
35 MessageBox.Show(ex.Message);
36 }
37
38
39
40 int iRowCnt = ds.Tables[0].Rows.Count;
41
42 ucMod[tabcnt].gridLineDataGridView1.Rows.Clear();
43
44 for (int ctrRow = 0; ctrRow < iRowCnt; ctrRow++)
45 {
46 ucMod[tabcnt].gridLineDataGridView1.Rows.Add();
47 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[1].Value = ucMod[tabcnt].Column2.Items[ucMod[tabcnt].Column2.Items.IndexOf(ds.Tables[0].Rows[ctrRow][1].ToString().Trim())];
48 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[2].Value = ds.Tables[0].Rows[ctrRow][0].ToString().Trim();
49 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[3].Value = ds.Tables[0].Rows[ctrRow][2].ToString().Trim();
50 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[4].Value = ds.Tables[0].Rows[ctrRow][3].ToString().Trim();
51 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[5].Value = ds.Tables[0].Rows[ctrRow][4].ToString().Trim();
52 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[6].Value = ds.Tables[0].Rows[ctrRow][5].ToString().Trim();
53 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[7].Value = ds.Tables[0].Rows[ctrRow][6].ToString().Trim();
54 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[8].Value = ucMod[tabcnt].Column9.Items[ucMod[tabcnt].Column9.Items.IndexOf(ds.Tables[0].Rows[ctrRow][7])];
55 ucMod[tabcnt].gridLineDataGridView1.Rows[ctrRow].Cells[9].Value = ucMod[tabcnt].Column10.Items[ucMod[tabcnt].Column10.Items.IndexOf(ds.Tables[0].Rows[ctrRow][8].ToString().Trim())];
56 }
57 }
Thanks
Akhil
|
|
|
|
|
Hi,
at first, use parametrized SqlCommands instead of joining strings, this is very big security hole.
To your question. Just try this:
DataGridView dgv = new DataGridView();
dgv.DataSource = ds.Tables["your_table"];
It should be working, but i cut it off from "Filling DataGrid", where you assign this DataGridView to DataGrid.DataSource . Maybe the DataGridView is filled only when it is used, for ex. with DataGrid .
And what is ucMod[tabcnt].gridLineDataGridView1 ?
|
|
|
|
|
Hmm, that seems not to work too..
Last thing, code from VS Help:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
public class Form1 : System.Windows.Forms.Form
{
private DataGridView dataGridView1 = new DataGridView();
private BindingSource bindingSource1 = new BindingSource();
private SqlDataAdapter dataAdapter = new SqlDataAdapter();
private Button reloadButton = new Button();
private Button submitButton = new Button();
[STAThreadAttribute()]
public static void Main()
{
Application.Run(new Form1());
}
public Form1()
{
dataGridView1.Dock = DockStyle.Fill;
reloadButton.Text = "reload";
submitButton.Text = "submit";
reloadButton.Click += new System.EventHandler(reloadButton_Click);
submitButton.Click += new System.EventHandler(submitButton_Click);
FlowLayoutPanel panel = new FlowLayoutPanel();
panel.Dock = DockStyle.Top;
panel.AutoSize = true;
panel.Controls.AddRange(new Control[] { reloadButton, submitButton });
this.Controls.AddRange(new Control[] { dataGridView1, panel });
this.Load += new System.EventHandler(Form1_Load);
this.Text = "DataGridView databinding and updating demo";
}
private void Form1_Load(object sender, System.EventArgs e)
{
dataGridView1.DataSource = bindingSource1;
GetData("select * from Customers");
}
private void reloadButton_Click(object sender, System.EventArgs e)
{
GetData(dataAdapter.SelectCommand.CommandText);
}
private void submitButton_Click(object sender, System.EventArgs e)
{
dataAdapter.Update((DataTable)bindingSource1.DataSource);
}
private void GetData(string selectCommand)
{
try
{
String connectionString =
"Integrated Security=SSPI;Persist Security Info=False;" +
"Initial Catalog=Northwind;Data Source=localhost";
dataAdapter = new SqlDataAdapter(selectCommand, connectionString);
SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);
DataTable table = new DataTable();
table.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter.Fill(table);
bindingSource1.DataSource = table;
dataGridView1.AutoResizeColumns(
DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
}
catch (SqlException)
{
MessageBox.Show("To run this example, replace the value of the " +
"connectionString variable with a connection string that is " +
"valid for your system.");
}
}
}
|
|
|
|
|
Hi
why are we using
table.Locale = System.Globalization.CultureInfo.InvariantCulture;
in the code
Regards
Akhil.N.P
|
|
|
|
|
I tried the below code but it is not woking. What may be the problem.
MySqlDataAdapter dAdapter;
BindingSource bs = new BindingSource();
DataTable dTable = new DataTable();
private void Form1_Load(object sender, EventArgs e)
{
dataGridView1.DataSource = bs;
dataGridView1.AutoGenerateColumns = false;
}
private void button1_Click(object sender, EventArgs e)
{
string connString;
string query;
connString = ConfigurationSettings.AppSettings.Get("OEMProjLogDB").ToString().Trim();
query = "SELECT * FROM `Update`";
dAdapter = new MySqlDataAdapter(query, connString);
dTable.Locale = System.Globalization.CultureInfo.InvariantCulture;
dAdapter.Fill(dTable);
bs.DataSource = dTable;
dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
}
Akhil.N.P
|
|
|
|
|
hi,
But Here my datagrid contains comboxes and check boxes so when i do this blank rows ae filled.
Regards
Akhil.N.P
|
|
|
|
|
Why to put checkboxes into datagrid maually? If the column is type of bool , datagrid automatically put checkboxes into this column. And about comboboxes, the column should be then some type of enum or something alike.
And by the way, i think, that DataGridView is only in memory, it provides data to DataGrid , which is displayed. Standard DataGrid filling is creating DataGridView , set its DataSource to some DataSet table. Then set DataGrid 's DataSource to this DataGridView and you are done.
|
|
|
|
|
Thanks for the Answer. But my problem again persist, coz i am using MySQL database engine. In MySQL True and False is stored as TINYINT[1] so it behaves as integer (TRUE-1, FALSE-0). So how come the datagrid automaticaly put checkboxes into this column by taking 0 and 1.
Thanks & Regards
Akhil.N.P
|
|
|
|
|
ucMod[tabcnt].gridLineDataGridView1 is the datagridview ucMod[] is a userControl in which the grid is present
|
|
|
|
|
Hi,
I have an images app, which consists of 2 main sub-apps. The viewer and editor. Editor should be installed only on one PC, the viewer will be installed and used by many customers. The problem is, how to distribute new images created in editor to customers.
(I have tried my own solution, downloading up-to-date database (*.mdf), read modified items and download these items. But i wasn't able to overwrite customer's local db (and etc.), so this was wrong way.)
Then I thought I could use directly ClickOnce Update system. I took installation files created with VS2005 and with mage.exe I successfully added new images to application's manifest, signed it and the same did to deployment manifest. The problem is, when i add some images to app. manifest using mage.exe and raise version of app. and deploy manifests (with the same exe files), install / update doesn't download anything, just raise the local version. ClickOnce checked that there is new version, but because of that i didn't modify the exe, the hash stayed same and no download was done. Even that the manifest contains new image files. So, can i somehow force ClickOnce not to compare exe's hash and download modified related images? Or somehow change the exe so the hash-check will fail and the exe with images will be downloaded.
Thank you.
|
|
|
|
|
Hi folks,
I'm trying to get a little color animation working for a Border(ed)-area. The Border has a style defined like this:
<Border x:Name="border"
CornerRadius="0,4,4,0"
BorderBrush="#FFD2DAED"
BorderThickness="1">
<ContentPresenter TextBlock.Foreground="White" />
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFF6F9FD" Offset="0"/>
<GradientStop Color="#FFE4ECF6" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<Border.Triggers>
<EventTrigger RoutedEvent="Mouse.MouseEnter">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard Storyboard.TargetName="Border.BorderBrush"
Storyboard.TargetProperty="Color" >
<ColorAnimation
To="#FFD2DAED"
From="#FF000000"
Duration="0 :1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Border.Triggers>
</Border>
My guess is, that the TargetName-property of the storyboard is misgiven. What would be the right path?
When this is solved, I'd like to add an animation for the background (LinearGradienBrush). How can I set that path?
Thank's in advance for you help!
Regards,
Stevie
Greetings,
Stephan Eberle
hawke@deltacity.org
|
|
|
|
|
Nevermind! WPF is just great and I failed to see its greatness!
Use of ControlTemplate.Triggers solved my problem!
Greetings,
Stephan Eberle
hawke@deltacity.org
|
|
|
|
|
Hi, i am writing whats turning into quite a large (little) program that displays thumbnails (1 - 200) in a a form which also has a timer which activates a backgroundworker process which updates a listbox with info.
It all works fine untill i leave it minimized for an hour or so then the form is only visible in the taskbar (its icon) . Its as if its minimized but clicking it activates (the taskbar icon changes colour etc with focus) but it wont maximise.
If i use the taskmanager it says the program is 'Running' and by right clicking and selecting 'Maximise' the window will appear maximised but all the controls on the form arent displaying the images or listboxes, its as if the application has crashed. I need to 'end task' to exit the program the menus and close (x) icon dont respond.
Like i said the application runs fine if i interact with it, it appears to only 'crash to taskbar' if i leave it unattended for an hour or so.
Any ideas where i might start looking to resolve this?
Thanks
modified on Friday, September 12, 2008 6:54 PM
|
|
|
|
|
teddycrew wrote: Any ideas where i might start looking to resolve this?
If by ideas you mean guesses, my first guess would be the fact that you are using multiple threads. Most novice multi-threading developers create errors related to the threading because they lack the knowledge. Things like the BackgroundWorker class just make it worse because people think they can just drag and drop and don't need to understand the complex aspects of multi-threading. It just ain't so. Then the next thing you know, strange behavior.
led mike
|
|
|
|
|