Skip to content

Instantly share code, notes, and snippets.

@phinett
phinett / gist:1932299
Created February 28, 2012 12:37
MultiMap Index - RavenDb
public class GroupsIndex_ByAccount : AbstractMultiMapIndexCreationTask<GroupsIndex_ByAccount.ReduceResult>
{
public class ReduceResult
{
public string Id { get; set; }
public string GroupId { get; set; }
public string Name { get; set; }
public string AccountId { get; set; }
public DateTimeOffset DateJoined { get; set; }
@phinett
phinett / Audio_Index.cs
Created March 9, 2012 17:43
Stale Index Issue
public Audio_Index()
{
// audio properties
Map = audios => from audio in audios
select new
{
Id = audio.Id,
AudioId = audio.Id,
AccountId = audio.AccountId,
ArtistName = audio.ArtistName,
@phinett
phinett / AudioHitImport.cs
Created March 15, 2012 12:47
Import script from sql server to RavenDb
namespace HM.ImportFromNHibenate.ImportAudios
{
public static class ImportAudioHits
{
private class DummyAudio
{
public int NHibernateId { get; set; }
public string NewId { get; set; }
public string NewAccountId { get; set; }
}
@phinett
phinett / gist:2420435
Created April 19, 2012 11:47
AudioUpdateConsoleTask.cs
namespace HM.AudioStatisticsUpdateTask
{
public static class StatsTask
{
public static void Execute()
{
IList<string> dayYears = new List<string>();
// this is so we can query on our index for the last 7 days
for (int i = 0; i < 7; i++)
@phinett
phinett / gist:2435957
Created April 21, 2012 09:02
AudioList
[HttpGet]
public ActionResult Index(string sortBy, int page, string genreCode)
{
Genre genreOutputFromQuery = new Genre();
const int pageSize = 25;
RavenQueryStatistics stats;
IList<Core.Documents.Audio> audios;
if (page < 1)
@phinett
phinett / gist:2478785
Created April 24, 2012 11:00
Stats.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using HM.Core.Documents;
using HM.Core.Infrastructure.Indexes;
using Raven.Abstractions.Commands;
using Raven.Abstractions.Data;
using Raven.Abstractions.Linq;
Server Error in '/' Application.
The remote server returned an error: (500) Internal Server Error.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
Source Error:
Server Error in '/' Application.
The remote server returned an error: (500) Internal Server Error.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
Source Error:
Server Error:
-----------------------------------------
/docs/Raven/Hilo/AudioStatCounters
System.Exception: Error reading RavenJObject from JsonReader.
at Raven.Json.Linq.RavenJObject.Load(JsonReader reader) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Abstractions\Json\Linq\RavenJObject.cs:line 229
at Raven.Storage.Esent.StorageActions.DocumentStorageActions.ReadDocumentData(String key, Guid existingEtag, RavenJObject metadata) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Storage\Esent\StorageActions\Documents.cs:line 174
at Raven.Storage.Esent.StorageActions.DocumentStorageActions.<DocumentByKey>b__1(JsonDocumentMetadata metadata, Func`4 createDocument) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Storage\Esent\StorageActions\Documents.cs:line 39
at Raven.Storage.Esent.StorageActions.DocumentStorageActions.DocumentByKeyInternal[T](String key, TransactionInformation transactionInformation, Func`3 createResult) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Storage\Esent\StorageActions\D
Windows Users
Open Notepad as administrator (right click and choose Run as administrator)
Navigate to:
c:\windows\system32\drivers\etc\
You have to change it from showing 'Text Documents (.txt)' to 'All Files (*.*)'
Open the file called 'hosts'