Wednesday, November 27, 2013

Example of Singleton pattern

    public class sing
    {
        private static sing Sing;

        private sing()
        {

        }

        public int x;
        public int y;
        public static sing SING
        {
            get
            {
                if (Sing == null)
                {
                    Sing = new sing();
                }
                return Sing;
            }
        }

    }


static void Main(string[] args)
        {

            sing.SING.x = 7;

            Console.WriteLine(sing.SING.x.ToString());

Thursday, November 21, 2013

still getting excel save prompt with automation

tried these 2 ideas

  object misValue = System.Reflection.Missing.Value;
                        workBook.Saved = true;
                        workBook.Close(false, misValue, misValue);

Tuesday, November 19, 2013

This document is opened by another project

i was getting this message on a class - I had added a member class to the class and it was being picked up in only some locations - somehow there was a connection

my advice - close VS - even compiling solution did not help

Thursday, November 14, 2013

Tuesday, November 12, 2013

Monday, November 11, 2013

Dependency injection

here

if the pattern used creates the dependencies in properties but allows sets as follows:

#if DEBUG
            set { m_blah = value; }
#endif


I am not sure if this is true dependency injection

using random in sql for unique values

create table #tempo (id int unique identity, val varchar(100)  unique, other  varchar(1000))
insert into #tempo(val,other  )
select cast (cast(RAND() * 100000000 as int ) as varchar)    ,'fdgfggdfdfgdg'
union select cast(cast( RAND()* 100000000 as int) as varchar)   ,'fdfgdfdfgdg'
select * from #tempo
drop table #tempo

IISRESET vs Recycling Application Pools

here

Wednesday, November 6, 2013

Table types in Team City

create a script that drops the sp's that reference the table type - drop the table type
have this run before the sp's do

HTTP 304 - visibility

You will only see on the browsers network traffic- not Fiddler

Monday, November 4, 2013

How to get to dynamically loaded javascript in browser debugger

in IE if you run it once the script will be available in the source
all browsers - use "debugger"  keyword
all browsers - place breakpoint in static JS and f10 from there

force jquery not to use cache

$.ajax({url: "url", success: Callback, cache: false});


and avoid http 304!