Category Archives: Code

T-SQL paging

–snippet for paging on server. Is there a simpler way? DECLARE @PageNum AS INT; DECLARE @PageSize AS INT; SET @PageNum = 1; SET @PageSize = 10; WITH TablePage AS ( SELECT ROW_NUMBER() OVER(ORDER BY theDate, someId) AS RowNum, otherFields FROM … Continue reading

Posted in Code | 1 Comment

C# system.tray icon animation how to

http://blogs.msdn.com/b/abhinaba/archive/2005/09/12/animation-and-text-in-system-tray-using-c.aspx The only thing I would add is DllImport(“user32.dll”, EntryPoint = “DestroyIcon”)]static extern bool DestroyIcon(IntPtr hIcon); and then DestroyIcon(hIcon); Read somewhere that  bitmap.GetHicon(); leaks. Haven’t verified it.

Posted in Code | Leave a comment

CSLA and nHibernate

For awhile I’ve been trying to integrate Csla and nHibernate. Being new to nHibernate that is where my difficulties lay. However, recentlly I’ve come accross an excellent tutorial by Gabriel Schenker. You can find it here. It was not too … Continue reading

Posted in Code, Geek | Leave a comment

I heard the screen door slam

and a Took away my old man… Joni Mitchel ~1970

Posted in Code, Fun, Music, Vista | Leave a comment

CSLA C# FilteredBindingList example – try 2

define the filter… public static bool OnHandFilter(object item, object filter) { bool result = false; if (item != null && filter != null) { int value = 0; int filterValue = 0; bool itemParseStatus = int.TryParse(item); bool filterParseStatus = int.TryParse(filter); … Continue reading

Posted in Code, Geek | Tagged | Leave a comment

Frustrating error of the day

An error occurred creating the configuration section handler for loggingConfiguration: Could not load file or assembly ‘Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0×80131040) … Continue reading

Posted in Code, Geek | Tagged | Leave a comment

C# datagridview combox howTo

DataGridViewComboBoxColumn colFormat= new DataGridViewComboBoxColumn(); colFormat.DataSource = formatList; colFormat.DisplayMember = “Format”; colFormat.ValueMember = “FormatId”; colFormat.HeaderText = “Format”; colFormat.DropDownWidth = 100; colFormat.Width = 100; this.dgvASIN.Columns.Insert(1, colFormat); this.dgvASIN.Columns[1].DataPropertyName = “FormatId”;

Posted in Code, Geek | Leave a comment

How to get an icon from an embedded resource file using c# .NET

How to read an icon from an embedded resource file. c# Assembly targetAssembly = Assembly.GetExecutingAssembly(); Icon icon = new Icon ( targetAssembly.GetManifestResourceStream ( “project.Resources.Configuration.ico”) ); Where “project” is your project name “Resources” is your resource file name, without the extension … Continue reading

Posted in Code, Geek | Tagged , | 1 Comment