Wednesday, December 23, 2015

url in menus

will not be there for categories or products - this is system generated

Wednesday, November 25, 2015

Tuesday, November 24, 2015

making the workspace server

in tfs improved performance muchly - we have large projects

Friday, November 13, 2015

when updating dll in modules on orchard

you may have to update the dependency folder even if you did an app pool reset

Wednesday, November 4, 2015

latest changes sp's

SELECT name, create_date, modify_date
FROM sys.objects
WHERE type = 'P'
order by modify_date desc

Wednesday, October 28, 2015

There was no endpoint listening at

oh my. I didn't check the address - it was missing ;(

Thursday, October 22, 2015

order by on binary cast as bigint

order by cast(sequence_no as bigint)

will not order by correctly

Monday, October 19, 2015

poweliks virus

addressed here 

actually, in my case I had a mp4 I had downloaded from youtube through a downloading site.
the mp4 itself was doing the trouble - so I went in safe mode and deleted the file - I even had to clear recycle bin


now it looks ok

Thursday, October 8, 2015

Monday, September 21, 2015

sql server profiler woes

i couldnt see anything with sp - stmt start - i only saw with rpc completed

Thursday, September 17, 2015

http 404 error on wcf rest service httpget

i was getting because of the length of the querystring

Tuesday, August 25, 2015

sc vs installutil

i forgot how troublesome installutil is - i had a name with "-" and it wasnt coming up right so I used sc - way to go

Monday, July 20, 2015

bizarre NullLogger behaviour

i was using NullLogger in orchard and I needed to do this
    public MenuProvider(UrlHelper urlHelper, IOrchardServices services)
              {
                     _urlHelper = urlHelper;
                     _services = services;
            Logger = NullLogger.Instance;

              }
instead of just referring to NullLogger.Instance.Log("blah")

Thursday, July 9, 2015

View dependencies

in ssms is not always correct because it depends on sysdepends



this is more accurate

select t.name as TableWithForeignKey, fk.constraint_column_id as FK_PartNo , c.name as ForeignKeyColumn
from sys.foreign_key_columns as fk
inner join sys.tables as t on fk.parent_object_id = t.object_id
inner join sys.columns as c on fk.parent_object_id = c.object_id and fk.parent_column_id = c.column_id
where fk.referenced_object_id = (select object_id from sys.tables where name = 'BLAH')
order by TableWithForeignKey, FK_PartNo

cache: false in $.ajax( calls

work because they add the following request header
  1. Cache-Control:
    no-cache

Wednesday, July 8, 2015

De-serialization issue checklist

make sure

1) all base classes and properties are properly adorned
          [DataContract]
          [Serializable]

2) base class and property may need also knowntype
       [KnownType(typeof(BlahBase))]

        public class Blah: BlahBase

in order to get type name from collection

 typeof(T).FullName.Between(


the between is an extension i found here 

for Serialization with distributed caching

 [DataContract]

was not enough

i needed

[Serializable]

Tuesday, June 23, 2015

Thursday, May 28, 2015

for missing taskbar in windows

for example after installing software ->

open task manager->start explorer

Thursday, May 21, 2015

mapping fake routes in MVC

routes.MapRoute(
               "Boris",
               "Boris/Show",
               new
               {
                   controller = "Herby",
                   action = "Index"
               }
           );

if your'e lazy and have simple "and"s separated by "or"s

then neat "and"s and or"s work like parentheses

select * from

(
select 1 a , 'hi there' b , 102 c
union
select 2 a , 'hi there' b , 103 c
union
select 10 a , 'hi there' b , 103 c
union
select 9 a , 'hi there' b , 103 c
union
select 8 a , 'by there' b , 103 c
union
select 7 a , 'by there' b , 103 c
union
select 6 a , 'by there' b , 10 c

) as main
where b = 'by there'
and a=6
or a > 1
and a < 4
and b = 'hi there'
or a = 10

and b = 'hi there'

Simple MVC Filter

public class TestFilter : ActionFilterAttribute
    {
       public override void   OnActionExecuted(ActionExecutedContext filterContext)
        {
            base.OnActionExecuted(filterContext);
            System.IO.File.AppendAllText(@"c:\log.txt", string.Format("{0}\r\n", filterContext.RequestContext.HttpContext.Request.Url.ToString()));

        }
    }


In global.asax:



  protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);

            GlobalFilters.Filters.Add(new TestFilter());

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

        }

is your app

skinnable?

Wednesday, May 13, 2015

Tuesday, April 28, 2015

file schema could not be identified because of an i/o error

i got this trying to read a _Traces.svclog with too many viewers open - wierd

Wednesday, March 25, 2015

top variable needs parentheses

declare @int int = 10

select top (@int) * from

bozo

more things done to improve sql

if force order hint is used - put left joins after inner joins
create indicies on temp tables after inserts

Tuesday, March 24, 2015

Tuesday, March 17, 2015

Monday, March 9, 2015

to avoid distributed transaction errors during debugging

on the callee comment out :

/*[OperationBehavior(TransactionScopeRequired = true,
TransactionAutoComplete = true)]*/

Thursday, February 26, 2015

debugging a windows service

follow this pattern in program file

#if DEBUG
            MethodInfo mi = qCenterService.GetType().GetMethod("OnStart", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.NonPublic);
            mi.Invoke(BlahService, new object[] { new string[0] });
            Console.ReadLine();
#else
                     ServiceBase.Run(new ServiceBase[] { BlahService });

#endif

Monday, February 16, 2015

recent things done to an important and complex sql query to improve performance


  1. changed cross- apply to cte's
  2. added indices that had all the output columns needed instead of using clustered index which forced more reads
  3. removed max varchar columns from initial query to avoid key lookups and retrieved them at end of sql

Sunday, February 1, 2015

asp.net: Invalid postback or callback argument

<%@ Page EnableEventValidation="false" %>

CORS in asp.net

<httpProtocol>
        <customHeaders>
            <add name="Access-Control-Allow-Origin" value="*" />
            <add name="Access-Control-Allow-Methods" value="GET,POST,OPTIONS" />
            <add name="Access-Control-Allow-Headers" value="Content-Type, soapaction" />
        </customHeaders>
    </httpProtocol>

Friday, January 30, 2015

another simple sql question

drop table x
create table x(x int, y int)
insert into x values (1,2)
update  x set x=y , y=x
select * from x

what happens

Thursday, January 22, 2015

Would you believe...

select 1 where  'Draft' like  '%' + 'Dr' + '%'
select 1 where    '%' + 'Dr' + '%' like  'Draft'


i guess its obvious that what follows like is a subset

Thursday, January 15, 2015

Getting values out of a JSON object in c# when the object is an array


                         var values =    JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(strVal);
                         foreach (var val in values)
                           {
                               blah.Add(int.Parse(val.First(x => x.Key.Equals("blahId")).Value.ToString()));

  

Downloading Files in MVC where excel is not actually opened

I inherited from FileResult and it did not download - even though I set download name

I did this and it works

     public FileResult DownloadTextAsAFile(string data, string name)
        {
        string fileName = string.Format("{0}.csv", name);
        byte[] bytes = System.Text.Encoding.UTF8.GetBytes(data);
        return new FileContentResult(bytes, "application/vnd.ms-excel") { FileDownloadName = name };
        }

Wednesday, January 14, 2015

to select a particular forms elements in jquery

just use the form's id as one of the selectors

Force filedownload

response.AppendHeader("content-disposition", "attachment; filename=" + FileDownloadName);

Add an action to a form with jquery

$("#blah").get(0).setAttribute('action', blahURL);