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
open System | |
open System.IO | |
type FileWithLength = {Path: string; | |
Length: int64} | |
type FileWithLengthAndStreamBuffer = {FileWithLength: FileWithLength; | |
Str: System.IO.FileStream; | |
Buf: byte[]} |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Threading.Tasks; | |
using Microsoft.Owin; | |
namespace ZipMiddleware | |
{ | |
using AppFunc = Func<IDictionary<string, object>, Task>; |
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
# -*- coding: utf-8 -*- | |
# lol, hadde tenkt lett, fikser streaming og sånt, men ble dritsur og gav nesten opp pga | |
# diverse encoding issues, men einar sendte meg noe greier så jeg fikk feilsøkt litt | |
# viste seg at BOM encoding ødela en del, i tillegg til alt annet surr. | |
# fant også en del her om iterators og strømmer | |
# http://blog.etianen.com/blog/2013/10/05/python-unicode-streams/ | |
# mye av det jeg har gjort var vel egentlig basert på einars eksempel | |
# Har brukt lazy enumerables sammen med streams en del på jobben i det siste, så ville lissom få det til å virke | |
# Skal være streaming og samtidig skal den teste seg selv før den skriver ut kode, hvis dokumentarene feiler | |
# så kræsjer programmet. Artig |
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
FROM ( | |
SELECT ROW_NUMBER() OVER (ORDER BY [t0].[FirstName]) AS [ROW_NUMBER], [t0].[FirstName] | |
FROM [dbo].[Profile] AS [t0] | |
) AS [t1] | |
WHERE [t1].[ROW_NUMBER] BETWEEN @p0 + 1 AND @p0 + @p1 | |
ORDER BY [t1].[ROW_NUMBER]',N'@p0 int,@p1 int',@p0=200000,@p1=1 |
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
SELECT TOP (1000) | |
[Extent1].[FirstName] AS [FirstName] | |
FROM ( SELECT [Extent1].[Id] AS [Id], [Extent1].[FirstName] AS [FirstName], row_number() OVER (ORDER BY [Extent1].[Id] ASC) AS [row_number] | |
FROM [dbo].[Profile] AS [Extent1] | |
) AS [Extent1] | |
WHERE [Extent1].[row_number] > 200001 | |
ORDER BY [Extent1].[Id] ASC |
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
exec sp_executesql N' | |
SELECT FirstName | |
FROM Profile | |
ORDER BY Id | |
OFFSET @offset ROWS | |
FETCH NEXT @pagesize ROWS ONLY | |
',N'@offset bigint,@pagesize bigint',@offset=200001,@pagesize=1000 |
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
let getNamesCmd() = new SqlCommandProvider<" | |
SELECT FirstName | |
FROM Profile | |
ORDER BY Id | |
OFFSET @offset ROWS | |
FETCH NEXT @pagesize ROWS ONLY", connectionString>() |
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
SELECT FirstName | |
FROM [dbo].[Profile] | |
ORDER BY Id ASC | |
OFFSET 200001 ROWS FETCH NEXT 1000 ROWS ONLY |
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
var profiles = from p in db.Profile | |
orderby p.Id | |
select p.FirstName; | |
return profiles.Skip(nrToSkip).Take(pagesize); |
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
SELECT | |
[Extent1].[FirstName] AS [FirstName] | |
FROM [dbo].[Profile] AS [Extent1] | |
ORDER BY [Extent1].[Id] ASC | |
OFFSET 200001 ROWS FETCH NEXT 1000 ROWS ONLY |