Skip to content

Instantly share code, notes, and snippets.

Thank you for your interest in contributing to UniDoc ("We" or "Us").

The purpose of this contributor agreement ("Agreement") is to clarify and document the rights granted by contributors to Us.

1. DEFINITIONS

"YOU" means the Individual Copyright owner who submits a Contribution to Us. If You are an employee and submit the Contribution as part of your employment, You

public class BlogPost
{
public string Name { get; set; }
public int Age { get; set; }
}
public class BlogModule : SinatraModule // Or whatever name we come up with
{
// This maps to /blogposts/edit/{id}
Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at System.Array.Copy (System.Array sourceArray, Int32 sourceIndex, System.Array destinationArray, Int32 destinationIndex, Int32 length) [0x00000] in <filename unknown>:0
at System.Collections.ArrayList.CopyTo (Int32 index, System.Array array, Int32 arrayIndex, Int32 count) [0x00000] in <filename unknown>:0
at System.Collections.ArrayList.CopyTo (System.Array array, Int32 arrayIndex) [0x00000] in <filename unknown>:0
at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0
at System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0
at ServiceStack.Common.ReflectionExtensions.FirstAttribute[AliasAttribute] (System.Type type, Boolean inherit) [0x00000] in <filename unknown>:0
at ServiceStack.Common.ReflectionExtensions.FirstAttribute[AliasAttrib
@ahall
ahall / gist:2710678
Created May 16, 2012 14:16
Async vs Sync for servicestack
// Code first
using System;
using ServiceStack.WebHost.Endpoints;
using System.Threading;
using ServiceStack.ServiceInterface;
using System.Threading.Tasks;
namespace ServiceStackBench
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
public class SessionPostAttribute : RequestFilterAttribute
{
public SessionPostAttribute()
{
this.Priority = -200;
this.ApplyTo = ApplyTo.Post;
}
public override void Execute(IHttpRequest req, IHttpResponse res, object requestDto)
{
This is the p/invoke
public static void CallBackAuth(IntPtr server,
IntPtr share,
IntPtr workgroup,
int wgmaxlen,
IntPtr username,
int unmaxlen,
IntPtr password,
int pwmaxlen)
Errors:
/Users/ahall/Projects/Nancy/src/Nancy.sln (default targets) ->
(Build target) ->
/Users/ahall/Projects/Nancy/src/Nancy/Nancy.csproj (default targets) ->
/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/mono/4.0/Microsoft.CSharp.targets (CoreCompile target) ->
Cryptography/DefaultEncryptionProvider.cs(21,20): error CS1674: `System.Security.Cryptography.Rfc2898DeriveBytes': type used in a using statement must be implicitly convertible to `System.IDisposable'
Cryptography/DefaultEncryptionProvider.cs(43,24): error CS1674: `System.Security.Cryptography.Rfc2898DeriveBytes': type used in a using statement must be implicitly convertible to `System.IDisposable'
@ahall
ahall / gist:1021457
Created June 12, 2011 11:23
Pagination
public class PaginatedList<T> : List<T>
{
private int totalItems;
private int totalPages;
public int PageIndex { get; private set; }
public PaginatedList(IQueryable<T> items, int pageIndex, int perPage)
{
PageIndex = pageIndex < 0 ? 0 : pageIndex;
[Route("/SendFile")]
public void SendFile(IManosContext ctx)
{
const string path = "/etc/services";
ctx.Response.Headers.SetNormalizedHeader("Content-Type", ManosMimeTypes.GetMimeType(path));
ctx.Response.SendFile(path);
ctx.Response.End();
}