Wednesday, November 28, 2012

For AJAX cross-site calls there is JSONP and there is:
jQuery.support.cors = true;

http://dhanushkaat.blogspot.com/2011/11/performing-cross-domain-requests-with.html

Wednesday, October 3, 2012

javascript/jquery: Adjusting div height as window height changes


$(function () {

    function winresize() {
        var windowHeight = $(window).height();
        if (windowHeight > 300) {
            windowHeight = windowHeight - 200;
        }

        $("#bboard").css("margin-top", windowHeight);
    }

    winresize();

    $(window).resize(function () {
        winresize();
    });
});

Wednesday, August 15, 2012

Thursday, March 22, 2012

selecting drop down index with JQUery

Use the .attr('selectedIndex') property. For example

$("#testselect").attr('selectedIndex', 1);

Thursday, February 2, 2012

determining row in an item template using the row index:

http://www.ezzylearning.com/tutorial.aspx?tid=7597714

javascript:

row = $(editButton).parent().parent();
id = $("#id", row).text();
name = $("#name", row).text();
fee = $("#fee", row).text();
row.addClass("highlightRow");

html template:

html notes

RULES=ROWS indicates that there should be borders between rows but not between columns.

RULES = ROWS

diagrams

database

http://edn.embarcadero.com/article/31863

association -- a relationship between instances of the two classes. There is an association between two classes if an instance of one class must know about the other in order to perform its work. In a diagram, an association is a link connecting two classes.
aggregation -- an association in which one class belongs to a collection. An aggregation has a diamond end pointing to the part containing the whole. In our diagram, Order has a collection of OrderDetails.
generalization -- an inheritance link indicating one class is a superclass of the other. A generalization has a triangle pointing to the superclass. Payment is a superclass of Cash, Check, and Credit.
An association has two ends. An end may have a role name to clarify the nature of the association. For example, an OrderDetail is a line item of each Order.

A navigability arrow on an association shows which direction the association can be traversed or queried. An OrderDetail can be queried about its Item, but not the other way around. The arrow also lets you know who "owns" the association's implementation; in this case, OrderDetail has an Item. Associations with no navigability arrows are bi-directional.
finally different mvc mvvm , etc. explained simply:

http://wpftutorial.net/MVVM.html

Tuesday, January 31, 2012

set culture

CultureInfo ci = CultureInfo.CreateSpecificCulture(prefix);
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;

XDcoument Linq to AXML

public class FeedDefintion
{
public string State { get; set; }
public string Zip { get; set; }
}
public void ProcessRequest(HttpContext context)
{
//write your handler implementation here.
XDocument xdoc = XDocument.Load(context.Server.MapPath("Listings.xml"));




var feeds = from feed in xdoc.Descendants("Categories")
select new FeedDefintion { State = feed.Element("State").Value, Zip = feed.Element("Zip").Value };
List fl = feeds.ToList();


System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
new System.Web.Script.Serialization.JavaScriptSerializer();

string sJSON = oSerializer.Serialize(fl);

//context.Response.ContentType = "application/json";
context.Response.ContentType = "application/json";

sJSON = context.Request.QueryString["callback"] + "(" + sJSON + ");";
context.Response.Write(sJSON);
}

Monday, January 30, 2012

jsonp


http://www.giantflyingsaucer.com/blog/?p=2682

Sunday, January 22, 2012

Creates an instance of the specified type

Activator class is extremely powerful:

Contains methods to create types of objects locally or remotely, or obtain references to existing remote objects.

Activator.CreateInstance

Hashtable v. Dictionary

The Dictionary(Of TKey, TValue) and ConcurrentDictionary(Of TKey, TValue)classes have the same functionality as the Hashtable class. A Dictionary(Of TKey, TValue) of a specific type (other than Object) provides better performance than a Hashtable for value types. This is because the elements of Hashtable are of type Object; therefore, boxing and unboxing typically occur when you store or retrieve a value type. The ConcurrentDictionary(Of TKey, TValue)class should be used when multiple threads might be accessing the collection simultaneously.

Saturday, January 14, 2012

WCF Notes

The Svcutil.exe tool can be used only with XML Schema (XSD) files that support data contracts. If data contracts cannot be generated, you must use the Xsd.exe tool to generate XML-based data types from the XSD file.

Use SVCUtil.exe and not XSD.exe. Must read article:
http://blog.shutupandcode.net/?p=761


Validate XML with SoapExtension:
http://msdn.microsoft.com/en-us/magazine/cc164115.aspx

Thursday, January 12, 2012

SQL Notes

Find all references of a given stored proc or a given string.

syscomments has the body text for all user stored procs in the system.
So you may search all stored procs that contain a given text.
Suppose you want to see all references for a stored proc named up_MyProc.
You may accomplish this as follows:

declare @keyword nvarchar(100)
set @keyword = 'up_MyProc' -- Enter the key word here like 'OptInInd'
SELECT distinct 'sp_helptext ' + o.name
FROM syscomments s, sys.objects o
where s.id = o.object_id
and o.type = 'P'
and charindex(@keyword, s.text) > 0





******



The syntax for using an alias in an update statement on SQL Server is as follows:
UPDATE QSET Q.TITLE = 'TEST'
FROM HOLD_TABLE QWHERE Q.ID = 101;
So one could write and update based on selected rows:
 update pv 
  set pv.[LocalizedText]= (Select [LocalizedText] from [Np2n.v2.eCoCommon].[dbo].[LocalizationItem] as nv 
  where nv.[LocalizationItemID]='NP_Review_ShipMethod_Header' and 
nv.cultureid=pv.cultureid)  from  [Np2n.v2.eCoCommon].[dbo].[LocalizationItem] pv where   pv.[LocalizationItemID]='GG_Review_ShipMethod_Header' 
******
Mutliple  insert from another source:
INSERT INTO Store_Information (store_name, Sales, Date)
SELECT store_name, Sales, Date
FROM Sales_Information
WHERE Year(Date) = 1998