This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>JSON - JSONP tests</title> | |
<!--Include jquery--> | |
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
//DEF response | |
var data = {}; | |
data.title = "title"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//DEPENDENCIES | |
var express = require('express'); | |
//Initialize Express.js | |
var app = express(); | |
//JSONP Get Request | |
app.get('/endpointJSONP', function(req, res){ | |
//LOG |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//REPO | |
var objArray = [ | |
{id: 1, description: "Cuba libre", price: 6.00}, | |
{id: 2,description: "Beer",price: 3.50}, | |
{id: 3, description: "Vodka Lemon", price: 5.00}, | |
{id: 4, description: "Long island", price: 5.50}, | |
{id: 5, description: "Caipiroska", price: 7.50} | |
] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
*Contains all configuration used by GoogleApiClass | |
*/ | |
var configurations = { | |
geolocationFailed: "Error: Geolocation failed.", | |
geolocationNotSupported: "Error: Geolocation isn\'t supported", | |
locationFound: "You are here", | |
defaultLocation: new google.maps.LatLng(44.493587, 11.346584) //Bologna | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public bool ShouldSerialize MyPropertyName (){ | |
return true | false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Class Telefilm | |
[Serializable] | |
public class Telefilm | |
{ | |
public int TelefilmId { get; set; } | |
public string TelefilmName { get; set; } | |
public DateTime CreateDate { get; set; } | |
public bool ShouldSerializeCreateDate() { | |
return (!TelefilmName.Equals("Californication")); //Bool EXP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestClass] | |
public class ConditionalSerializingTests | |
{ | |
public Telefilm[] Telefilms = new Telefilm[]{ | |
new Telefilm{TelefilmId=1 , TelefilmName="Slevin" , CreateDate= new DateTime(1999,04,23)}, | |
new Telefilm{TelefilmId=2 , TelefilmName="Scrubs" , CreateDate= new DateTime(2001,02,08) }, | |
new Telefilm{TelefilmId=3 , TelefilmName="HIMYM" , CreateDate= new DateTime(2004,12,05)}, | |
new Telefilm{TelefilmId=4 , TelefilmName="Californication", CreateDate= new DateTime(2010,02,12)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IQueryable Take(this IQueryable source, int count) | |
{ | |
if (source == null) | |
throw Error.ArgumentNull("source"); | |
return source.Provider.CreateQuery( | |
Expression.Call( | |
null, | |
((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), | |
new Expression[] { source.Expression, Expression.Constant(count) } | |
)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable Take(this IEnumerable source, int count) | |
{ | |
if (source == null) throw Error.ArgumentNull("source"); | |
return TakeIterator(source, count); | |
} | |
static IEnumerable TakeIterator(IEnumerable source, int count) | |
{ | |
if (count > 0) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
public void IEnumerableBehavior() | |
{ | |
IEnumerable<Product> products = dc.Product | |
//This expression produces an SQL query | |
.Where(p => p.Name.Contains("LL")); | |
//IEnumerable: the following statement is an in-memory query | |
products = products.Take<Product>(100); | |
} |