SQL Server 2012 / 2014
DECLARE @RowsPerPage INT = 10, @PageNumber INT = 4
SELECT OrderId, ProductId
FROM OrderDetail
ORDER BY OrderId
OFFSET (@PageNumber - 1) * @RowsPerPage ROWS
FETCH NEXT @RowsPerPage ROWS ONLY
SQL Server 2005/2008/R2
DECLARE @RowsPerPage INT = 10, @PageNumber INT = ...
For getting the next 10 rows just run this query:
SELECT * FROM TableName ORDER BY id OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY;
Key points to consider when using it:
ORDER BY is mandatory to use OFFSET and FETCH clause.
OFFSET clause is mandatory with FETCH. You can never use, ORDER BY …
FETC...
Let's say we have a form like the one below. We want to send the data to our webserver via AJAX and from there to a script running on an external server.
So we have normal inputs, a multi-select field and a file dropzone where we can upload multiple files.
Assuming the AJAX POST request was succ...
//Create a new ExcelPackage
using (ExcelPackage excelPackage = new ExcelPackage())
{
//Set some properties of the Excel document
excelPackage.Workbook.Properties.Author = "VDWWD";
excelPackage.Workbook.Properties.Title = "Title of Document";
excelPackage.Workboo...
Introduction
NMAKE is a command-line utility developed by Microsoft to be used primarily in conjunction with Microsoft Visual Studio and/or the Visual C++ command line tools.
NMAKE is build system that falls under the Make family of build systems, but has certain distinct features that diverge fro...
Introduction
The Autotools are a group of programs that create a GNU Build System for a given software package. It is a suite of tools that work together to produce various build resources, such as a Makefile (to be used with GNU Make). Thus, Autotools can be considered a de facto build system gene...
Session storage service :
Common factory service that will save and return the saved session data based on the key.
'use strict';
/**
* @ngdoc factory
* @name app.factory:storageService
* @description This function will communicate with HTML5 sessionStorage via Factory Service.
*/
a...
If a view is created WITH SCHEMABINDING, the underlying table(s) can't be dropped or modified in such a way that they would break the view. For example, a table column referenced in a view can't be removed.
CREATE VIEW dbo.PersonsView
WITH SCHEMABINDING
AS
SELECT
name,
address
FROM d...
It is a bad practice to block on async calls as it can cause deadlocks in environments that have a synchronization context. The best practice is to use async/await "all the way down." For example, the following Windows Forms code causes a deadlock:
private async Task<bool> TryThis()...
//Using File.WriteAllBytes
using (ExcelPackage excelPackage = new ExcelPackage())
{
//create a new Worksheet
ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets.Add("Sheet 1");
//add some text to cell A1
worksheet.Cells["A1"].Value = "My fourt...
An IP address to an interface could be obtained via DHCP or Static assignment
DHCP
If you are connected to a network with a DHCP server running, dhclient command can get an IP address for your interface
$ dhclient <interface>
or alternatively, you could make a change to the /etc/network/...
File: /etc/resolv.conf contains a list of DNS servers for domain name resolution
Sample contents of the file:
nameserver 8.8.8.8 # IP address of the primary name server
nameserver 8.8.4.4 # IP address of the secondary name server
In case internal DNS server you can validate if this server reso...
Detailed instructions on getting amazon-cloudformation set up or installed.
Amazon cloud formation templates can be launched in three ways.
AWS Console.
AWS CLI.
AWS SDK available in Java, Ruby etc..
AWS CLI is one of the most intuitive CLI available. The commands are simple to ...
We can statically bootstrap an application by taking the plain ES5 Javascript output of the generated factory classes. Then we can use that output to bootstrap the application:
import { platformBrowser } from '@angular/platform-browser';
import { AppModuleNgFactory } from './main.ngfactory';
//...
function doGet(e){
var serveFile = e.parameter.servefile;
var id = e.parameter.id;
if(serveFile)
{
return downloadFile(id); // and Hyde
}
return HtmlService.createHtmlOutputFromFile('form.html'); // Jekyll
}
function fetchFromGoogleDrive() { // Jekyll
va...