Yahoo! Query Language (YQL)
The Yahoo! Query Language is an expressive SQL-like language that lets you query, filter, and join data across Web services. With YQL, apps run faster with fewer lines of code and a smaller network footprint.
Yahoo! and other websites across the Internet make much of their structured data available to developers, primarily through Web services. To access and query these services, developers traditionally endure the pain of locating the right URLs and documentation to access and query each Web service.
With YQL, developers can access and shape data across the Internet through one simple language, eliminating the need to learn how to call different APIs.
How Do I Get Started?
- Check out the YQL Console.
- Read how to access YQL from your application.
- Get your API Keys to sign your requests if you need them.
10 jQuery 1.3 Tips and Tricks for everyday use
Some useful jQuery Tips and Tricks for your everyday use. Removing and Hiding Dom Elements, Browser Detection, Toggling, Handling Select Lists and more.
Read more >>
Paging with LINQ in ASP.NET MVC
Here’s a really neat and simple way to add pagination to your LINQ results in ASP.NET MVC. The simple class can be also implemented in non ASP.NET MVC projects.
Note: You can change the source parameter to be List or just add a method overload.
PaginatedList Class
using System;
using System.Linq;
using System.Collections.Generic;
namespace MyApp.Helpers
{
public class PaginatedList : List
{
public int PageIndex { get; private set; }
public int PageSize { get; private set; }
public int TotalCount { get; private set; }
public int TotalPages { get; private set; }
public PaginatedList(IQueryable source, int pageIndex, int pageSize)
{
PageIndex = pageIndex;
PageSize = pageSize;
TotalCount = source.Count();
TotalPages = (int) Math.Ceiling(TotalCount / (double)PageSize);
this.AddRange(source.Skip((PageIndex) * PageSize).Take(PageSize));
}
public bool HasPreviousPage
{
get {return (PageIndex > 0);}
}
public bool HasNextPage {
get {return (PageIndex+1 < TotalPages);}
}
}
}
Controller
public ActionResult Index(int? page)
{
int pageSize = 15;
var content = MyAppRepository.FindContentByDate().ToList();
var pagedContent = new PaginatedList(content, page ?? 0, pageSize);
return View("Index", pagedContent);
}
View
Routes in Global.asax
routes.MapRoute(
"Index",
"Index/Page/{page}",
new { controller = "Home", action = "Index", page = 0 }
);
Random CSS themes give your Social Space a Design Twist
Many sites are using this technique to give a fresh interface on every page the user visits, giving the illusion of a fast passed user experience. Sites like MTV, Hulu, MP3.com and many others use different techniques to change the sites layout either by changing the colors, backgrounds or just converting the site to a huge ad campaign.
I came up with a simple PHP script to Random your Themes. It checks for CSS files on a specified folder and randomizes it. You can also set the parameter (theme.php?file=theme.css) if you want to have a static version. Note: Security has been stripped for clarity, setup up the script with your own security.
PHP
0) {
$rnd = rand(0, count($fileList)-1);
$file = $folder.$fileList[$rnd];
}
}
// Header and Content
if ($file != null) {
$meta = pathinfo($file);
$contentType = 'Content-type: '.$fileTypes[ $meta['extension'] ];
header ($contentType);
readfile($file);
}
?>
USE
JS detecting event support in browsers
As you may know there is no easy way of detecting which elements supports which events across browsers. Kangax from Perfection Kills has come up with a very clever way of detecting them.
JavaScript
var isEventSupported = (function(){
var TAGNAMES = {
'select':'input','change':'input',
'submit':'form','reset':'form',
'error':'img','load':'img','abort':'img'
}
function isEventSupported(eventName) {
var el = document.createElement(TAGNAMES[eventName] || 'div');
eventName = 'on' + eventName;
var isSupported = (eventName in el);
if (!isSupported) {
el.setAttribute(eventName, 'return;');
isSupported = typeof el[eventName] == 'function';
}
el = null;
return isSupported;
}
return isEventSupported;
})();
Use
isEventSupported(<"Type of Event>")
For a more detailed description visit Kangax blog
Debouncing Javascript Methods
What is debouncing anyways? Debouncing is any kind of hardware device or software that ensures that only a single signal will be acted upon for a single opening or closing of a contact. Imagine you have a form with a few elements that a user may access thru the tab key, on each element you have an onfocus event that will trigger an Ajax call to the server to acquire some data. You could just imagine how you could kill the server with all those Ajax calls! So that’s where debouncing comes into play. With debouncing your assuring that the method will be triggered in the element that the user intended to, although is not perfect it does work better than Throttling. Read more >>




