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
@{ | |
ViewBag.Title = "Server-Side Paging with PetaPoco DataTables"; | |
} | |
<table id="customers" class="table table-striped table-condensed"> | |
<thead> | |
<tr> | |
<th style='width: 4%'>Id</th> | |
<th>Last</th> | |
<th>First</th> |
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.Linq; | |
using System.Web; | |
using System.Web.Mvc; | |
using PetaPocoPage.Models; | |
namespace PetaPocoPage.Helpers | |
{ | |
public class DataTablesModelBinder : IModelBinder |
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.Web.Mvc; | |
using PetaPocoPage.Helpers; | |
using PetaPocoPage.Models; | |
using PetaPocoPage.Services; | |
namespace PetaPocoPage.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
private readonly Repository _repository = new Repository(); |
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.Globalization; | |
using System.Linq; | |
using PetaPoco; | |
using PetaPocoPage.Models; | |
namespace PetaPocoPage.Helpers | |
{ | |
public class DataTablesFormat | |
{ | |
public static object PageResponse(DataTablesPageRequest pageRequest, Page<Customer> report) |
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.Collections.Generic; | |
using PetaPoco; | |
using PetaPocoPage.Models; | |
namespace PetaPocoPage.Services | |
{ | |
public class Repository | |
{ | |
private readonly Database _database = new Database("PetaPocoPageDb"); |
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.Collections.Generic; | |
using System.Linq; | |
using System.Web.Mvc; | |
using StructureMap; | |
namespace Sample.Web.Helpers | |
{ | |
public class StructureMapFilterProvider : FilterAttributeFilterProvider | |
{ | |
public StructureMapFilterProvider(IContainer container) |
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 Page<SampleOption> GetAvailableSampleOptionsFor(int pageNumber, int pageSize, Guid companyId, Guid requirementId, string whereClause, string searchText, string orderBy) | |
{ | |
// Build our own Paging Count(*) query to use | |
var countQuery = Sql.Builder.Append(@" | |
WITH pcr(Id, ParentSampleGroupId, GroupLevel) AS | |
(SELECT cg.Id, cg.ParentSampleGroupId, 0 as GroupLevel | |
FROM SampleGroup cg INNER JOIN SampleWidgetGroupLimit l ON l.SampleGroupId = cg.Id | |
WHERE l.SampleWidgetId = @1 | |
union all | |
select np1.Id, np1.ParentSampleGroupId, GroupLevel + 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
kvothe:~ todd$ ps aux -u 9633 | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
todd 9633 0.0 0.7 961216 57948 ?? S 10:16AM 0:04.65 /Applications/Google Chrome.app/Contents/MacOS/Google Chrome -psn_0_7591741 | |
kvothe:~ todd$ ps aux -u 9633 | file - | |
/dev/stdin: ASCII text |
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
PS C:\> Get-Process -id 5904 | |
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName | |
------- ------ ----- ----- ----- ------ -- ----------- | |
1651 71 71700 74296 306 256.05 5904 chrome | |
PS C:\> Get-Process -id 5904 | Format-List * | |
__NounName : Process | |
Name : chrome |
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
#!/bin/bash | |
if [ ! -d $1/.git ] | |
then | |
echo "usage : $0 <repository root directory>" | |
exit | |
fi | |
declare -a baconbits=($(curl -s 'http://baconipsum.com/api/?type=all-meat¶s=5&start-with-lorem=1' | sed s/[^\ a-zA-Z\-]//g)) | |
bitsize=${#baconbits[@]} | |
idx=0 |