Skip to content

Instantly share code, notes, and snippets.

View asapostolov's full-sized avatar

Apostol Apostolov asapostolov

  • bilidpm.com/en
  • Plovdiv, Bulgaria
View GitHub Profile
@asapostolov
asapostolov / DeserializationTest.cs
Last active April 4, 2022 13:50
Failing Test on RavenDB.Client
public class DeserializationTest : RavenTestDriver {
private IDocumentStore? _documentStore { get; set; }
protected override void PreInitialize(IDocumentStore documentStore) {
base.PreInitialize( documentStore );
documentStore.Conventions.IdentityPartsSeparator = '-';
documentStore.Conventions.Serialization = new NewtonsoftJsonSerializationConventions() {
CustomizeJsonSerializer = serializer => {
serializer.TypeNameHandling = TypeNameHandling.Objects;
@asapostolov
asapostolov / FailingTest.cs
Created March 30, 2022 11:00
Automatic deserialization $type failing test
[Fact]
public void ShouldStoreAndRetrieveDictionary() {
string id = null;
using ( var session = _documentStore.OpenSession() ) {
var doc = new Test() {
Settings = new Dictionary<string, object>
{
{"lastUsedUnitId", new Dictionary<int, string>()
{
{1, "units-3368"}
@asapostolov
asapostolov / create-qr.mjs
Created February 15, 2022 11:02
Create SEEDS Payment QR
import request from 'sync-request';
var res = request("POST", `https://api-esr.hypha.earth/qr`, {
headers: {
"user-agent": "bot-user-agent"
},
json: {
"actions": [
{
"account": "token.seeds",
"name": "transfer",
Failed to execute mapping function on contracts-8314. Exception: System.InvalidOperationException: The output of the mapping function does not contain all fields that the index is supposed to group by.
Output: { AccountId &#x3D; accounts-994, ContractId &#x3D; contracts-8314, DateCreated &#x3D; 04&#x2F;02&#x2F;2019 15:03:47, DateLastModified &#x3D; 02&#x2F;24&#x2F;2020 09:13:05 }
Group by fields: AccountId,ContractId
Compiled index def:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
@asapostolov
asapostolov / RavenDbRqlIssue.cs
Last active April 9, 2020 13:34
Failing test for RavenDb 4 RQL and Lucene queries with NOT
using Raven.Client.Documents;
using Raven.TestDriver;
using Xunit;
using System.Linq;
using Raven.Client.Documents.Indexes;
using Raven.Client.Documents.Session;
using System;
namespace RavenDBTestCase {
public class RavenDbRqlIssue : RavenTestDriver {
@asapostolov
asapostolov / RavenDbRqlIssue.cs
Created April 9, 2020 13:27
Failing test for RavenDb 4 RQL and Lucene queries with NOT
using Raven.Client.Documents;
using Raven.TestDriver;
using Xunit;
using System.Linq;
using Raven.Client.Documents.Indexes;
using Raven.Client.Documents.Session;
using System;
namespace RavenDBTestCase {
public class RavenDbRqlIssue : RavenTestDriver {
@asapostolov
asapostolov / file.html
Created September 24, 2015 22:03
City of Plovdiv's Center in Polygon
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple Polygon</title>
<style>
html, body {
height: 100%;
margin: 0;
@asapostolov
asapostolov / config path change
Last active August 29, 2015 14:12
MiniBlog web.config as virtual application
<add key="blog:path" value="myblog"/>
@asapostolov
asapostolov / BaseController.cs
Last active August 29, 2015 14:05
RavenDB Session Management
public const string RavenSessionKey = "raven.session";
public IDocumentSession RavenSession { get; set; }
protected override void Initialize( System.Web.Routing.RequestContext requestContext ) {
base.Initialize( requestContext );
RavenSession = (IDocumentSession) HttpContext.Items[ RavenSessionKey ];
}
@asapostolov
asapostolov / RavenConflictsConsole
Created January 30, 2014 10:30
Console application for fixing RavenDB conflicts through
namespace ConsoleApplication {
class Program {
static void Main( string[] args ) {
var store = new DocumentStore() {
Url = "<your-url-here>",
Credentials = new System.Net.NetworkCredential() {
UserName = "<your-username>",
Password = "<your-password>",