“Straighter is greater” — Walter Ray Williams, legendar
“Älska att vinna; få aldrig nog av att göra strike. Alla kan göra strike men vinnaren gör även spärr. Spärra så får du chansen att vinna.” — Lidas, Fredrikshof IF
/** | |
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js` and `jasmine_html.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project. | |
If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms. | |
The location of `boot.js` can be specified and/or overridden in `jasmine.yml`. | |
[jasmine-gem]: http://github.com/pivotal/jasmine-gem | |
*/ |
public class Indexer | |
{ | |
private readonly Dictionary<string, List<string>> terms = | |
new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase); | |
private readonly Dictionary<string, List<string>> docsTerms = | |
new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase); | |
public void Index(string docId, string text) | |
{ | |
List<string> docTerms; |
public class Program | |
{ | |
static void Main() | |
{ | |
var words = File.ReadAllText(@"C:\Programming\words.txt") | |
.Split(' ', '\r', '\n') | |
.Select(x => x.Trim()) | |
.Where(x => !string.IsNullOrEmpty(x)) | |
.ToArray(); | |
var candidates = new Dictionary<string, int>(); |
using System; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Reflection; | |
using System.Threading.Tasks; | |
using Raven.Abstractions.Data; | |
using Raven.Abstractions.Indexing; | |
using Raven.Client; | |
using Raven.Client.Embedded; | |
using Raven.Client.Indexes; |
// http://rosettacode.org/wiki/Primality_by_trial_division#By_Regular_Expression | |
function isPrime(n) { | |
var e = /^1?$|^(11+?)\1+$/; | |
return !e.exec('1'.repeat(n)); | |
} |
“Straighter is greater” — Walter Ray Williams, legendar
“Älska att vinna; få aldrig nog av att göra strike. Alla kan göra strike men vinnaren gör även spärr. Spärra så får du chansen att vinna.” — Lidas, Fredrikshof IF
First of all, here’s something you can do with the Specification class to reduce some of the code you have to write. Add the following methods:
public AndSpecification<TEntity> And(Expression<Func<TEntity, bool>> second)
{
return new AndSpecification<TEntity>(this, new Specification<TEntity>(second));
}
public OrSpecification<TEntity> Or(Expression<Func<TEntity, bool>> second)
{
return new OrSpecification(this, new Specification(second));
using System; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using Infrastructure.Data.Extensions; | |
namespace Infrastructure.Data.Specification | |
{ | |
public class Specification<TEntity> : ISpecification<TEntity> | |
{ | |
public Specification(Expression<Func<TEntity, bool>> predicate) |
<?xml version="1.0" encoding="utf-8" ?> | |
<!-- | |
This file needs to be put in the application directory. Make sure to set | |
'Copy to Output Directory' option in Visual Studio. | |
--> | |
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<targets> | |
<target xsi:type="Console" name="console" layout="${message}" /> | |
<target xsi:type="ColoredConsole" name="console-detailed" layout="${longdate} ${logger} ${level:upperCase=true}: ${message}${newline}(${stacktrace}) ${exception:format=ToString}" /> |
This is a project where I am intending to do a large-scale distributed calculation of an opening book for the board game Othello. Positions are stored in a relational database (I have chosen PostgreSQL) using NHibernate object/relational mapper.
The project is still in its infancy, but the goal is to use Edax, a very good Othello engine, to calculate new positions. I am also intending to use a service bus, probably