Wednesday, May 17, 2006
Anwendungsfall:
  • Es soll nur eine Instanz der Klasse existieren bzw. es soll nicht möglich sein, mehrere Instanzen der Klasse innerhalb eines Anwendungskontexts zu erzeugen.

Beispiele für die Anwendung:

  • Loadbalancer
  • ConnectionPools

Grafische Darstellung:

Beispielcode:

public class Singleton
{

   
private static Singleton instance;

   
private Singleton()
   {
   }

   public static Singleton GetInstance()
   {
      if (Singleton.instance == null)
      {
         Singleton.instance = new Singleton();
      }
      return Singleton.instance;
   }

}

5/17/2006 5:13:25 PM (Mitteleuropäische Sommerzeit , UTC+02:00)  #    Disclaimer  |  Comments [0]  | 

Problem:
You created a WebSite in Visual Studio 2005 and added a reference to another project or a .dll.
Now, if you want to remove this reference, you can't simply delete the .dll in the "Bin" folder of the WebSite. After a rebuild, the deleted .dll will be recreated from VS automatically.

Solution:
To remove the reference, open the Proptery Pages of the WebSite (right click on your WebSite in Solution Explorer and select "Property Pages"). The first time after a restart of VS, you will get the following "dialog":

Just try it once again, and it will work. Here you can remove your reference permanently.

5/17/2006 11:07:33 AM (Mitteleuropäische Sommerzeit , UTC+02:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, May 16, 2006

Search for the file setup.sdb on your cd or dvd.

There, normally on the last line, you will find an entry with the headline "[Product Key]".

This is the case for e.g. Visual Studio Team Foundation Server 2005 or for Visual Studio Team Suite 2005.

5/16/2006 4:04:56 PM (Mitteleuropäische Sommerzeit , UTC+02:00)  #    Disclaimer  |  Comments [1]  | 
 Monday, May 15, 2006
Get all tables including the system ones:
SELECT table_name FROM all_tables;

That will give you only the tables owned by the user that you are connecting as:
SELECT table_name FROM user_tables;

Query table columns:
SELECT * FROM all_tab_cols WHERE table_name = 'whatever table name you are looking for'

Looking for comments on the tables:
SELECT * FROM all_tab_comments WHERE table_name = 'whatever table name you are looking for'
5/15/2006 1:30:39 PM (Mitteleuropäische Sommerzeit , UTC+02:00)  #    Disclaimer  |  Comments [1]  | 
 Tuesday, December 20, 2005

...
Page page = new Page();
Control c = page.LoadControl("YourControl.ascx");
// do Something with your control, DataBind, ...

string html = RenderControl(c);

public static string RenderControl(Control ctrl)
{
   System.Text.
StringBuilder sb = new System.Text.StringBuilder();
   System.IO.
StringWriter tw = new System.IO.StringWriter(sb);
   System.Web.UI.
HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
   ctrl.RenderControl(hw);
   
return sb.ToString();
}

12/20/2005 5:51:20 PM (Mitteleuropäische Zeit , UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, November 30, 2005

You can save your data during a HttpRequest by passing it to System.Web.HttpContext.Current.Items[itemKey].
Objects stored in this Collection will be available during the whole lifecycle of the HttpRequest.

Example of usage:

System.Web.HttpContext.Current.Items["reloadCount"] = 5;

int reloadCount = (int) System.Web.HttpContext.Current.Items["reloadCount"];

11/30/2005 8:44:47 PM (Mitteleuropäische Zeit , UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
 Sunday, October 23, 2005

private DataSet ReadDataSet()
{
   DataSet ds = new DataSet();
   ds.ReadXml(dataPath,
XmlReadMode.ReadSchema);
   return ds;
}

private void WriteDataSet(DataSet ds, string path)
{
   ds.WriteXml(path,
XmlWriteMode.WriteSchema);
}

10/23/2005 10:34:16 AM (Mitteleuropäische Sommerzeit , UTC+02:00)  #    Disclaimer  |  Comments [1]  | 


public DataSet
GetCSVFile( string fileName)
{
     string pathName = System.IO. Path .GetDirectoryName(fileName);
     string file = System.IO. Path .GetFileName(fileName);
     OleDbConnection excelConnection = new OleDbConnection
     (@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ pathName + ";Extended Properties=Text;");
     OleDbCommandexcelCommand = newOleDbCommand(@"SELECT * FROM "+ file, excelConnection);
     OleDbDataAdapterexcelAdapter = newOleDbDataAdapter(excelCommand);
     excelConnection.Open();
     DataSetds = newDataSet();
     excelAdapter.Fill(ds);
     excelConnection.Close();
     return ds;
}

10/23/2005 9:48:47 AM (Mitteleuropäische Sommerzeit , UTC+02:00)  #    Disclaimer  |  Comments [1]  |