Skip to content

Instantly share code, notes, and snippets.

View jeremyiverson's full-sized avatar

Jeremy jeremyiverson

  • Colectica
  • Minneapolis, MN
View GitHub Profile
CREATE TABLE webpages_Membership (
UserId INT NOT NULL,
CreateDate TIMESTAMP NULL,
ConfirmationToken VARCHAR (128) NULL,
IsConfirmed BIT DEFAULT (('0')) NULL,
LastPasswordFailureDate TIMESTAMP NULL,
PasswordFailuresSinceLastSuccess INT DEFAULT ((0)) NOT NULL,
Password VARCHAR (128) NOT NULL,
PasswordChangedDate TIMESTAMP NULL,
PasswordSalt VARCHAR (128) NOT NULL,
@jeremyiverson
jeremyiverson / gist:4499147
Created January 10, 2013 03:20
Colectica SDK: General samples from Copenhagen training
using Algenta.Colectica.Model;
using Algenta.Colectica.Model.Ddi;
using Algenta.Colectica.Model.Ddi.Serialization;
using Algenta.Colectica.Model.Repository;
using Algenta.Colectica.Model.Utility;
using Algenta.Colectica.Repository.Client;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@jeremyiverson
jeremyiverson / gist:3794171
Created September 27, 2012 14:00
Colectica SDK: Find all referencing items. Group different versions of the same item together.
/// <summary>
/// Gets a list of items that reference the item specified by id.
/// This list may contain multiple entries for an individual item if
/// multiple versions of that item reference the base item.
/// We will group these "duplicates" and print each item only once,
/// with a list of matching versions if appropriate.
/// </summary>
/// <param name="id"></param>
public static void PrintReferencingItemInfo(RepositoryClientBase client, IdentifierTriple targetId)
{
@jeremyiverson
jeremyiverson / gist:3450451
Created August 24, 2012 13:18
Colectica SDK: Output hierarchical codes
public void OutputAllCodesAndCategoriesHierarchical(CodeScheme codeList)
{
foreach (Code code in codeList.Codes)
{
OutputCode(code, 1);
}
}
void OutputCode(Code code, int level)
{
@jeremyiverson
jeremyiverson / gist:3426952
Created August 22, 2012 15:52
Colectica SDK: Get all categories in a DDI CodeScheme
public void OutputAllCodesAndCategories(DdiInstance instance)
{
var allCodeLists = from rp in instance.ResourcePackages
from cs in rp.CodeSchemes
select cs;
foreach (CodeScheme codeList in allCodeLists)
{
Console.WriteLine("Code List: " + codeList.DisplayLabel);
@jeremyiverson
jeremyiverson / ImportVariablesAndConcepts.cs
Created August 2, 2012 19:39
Colectica SDK: Import DDI Variables and Concepts from a CSV file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Algenta.Colectica.Model.Repository;
using Algenta.Colectica.Repository.Client;
using Algenta.Colectica.Model.Ddi;
using Algenta.Colectica.Model;
using Algenta.Colectica.Model.Utility;
using System.IO;
@jeremyiverson
jeremyiverson / GetReferencingItems.cs
Created August 2, 2012 03:19
Colectica SDK: Find all referencing items, multiple levels away
Collection<IdentifierTriple> GetReferencingItems(RepositoryClientBase client, IdentifierTriple objectId, Guid subjectType)
{
// The set search will look for items of the specified type
// multiple levels away from the specified item.
// Note that this will be slower than a graph search,
// because the entire set must be determined.
// The ReverseTraversal property indicates that we want to
// find items that point *to* the specified item, instead
// of items referenced *by* the specified item.
@jeremyiverson
jeremyiverson / gist:3232816
Created August 2, 2012 03:02
Colectica SDK: Find all variables in a study's data files.
/// <summary>
/// Find all variables in a study's data files, and output some information about them.
/// </summary>
public void FindVariablesInStudyDataFiles(Guid identifier, string agency, long version)
{
IdentifierTriple studyID = new IdentifierTriple(identifier, version, agency);
var client = GetClient();
// First, get a list of all PhysicalInstances in the study.