This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public PlayCard GetClosestMatch(PlayCard playCard, long teamId) | |
{ | |
try | |
{ | |
var solr = SolrProxy.GetConnection<IndexedPlayCard>(); | |
var playCardDataQueries = IndexedPlayCard.GetPlayCardDataQueries(playCard.Data); | |
if (!playCardDataQueries.Any()) return null; | |
var results = solr.Query(new SolrMultipleCriteriaQuery(playCardDataQueries), new QueryOptions | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IFooDAO returns: | |
public class BaseFoo { | |
[BsonId] | |
public long _Id { get; set;} | |
} | |
// IFooService returns: | |
public class FooDTO { | |
public string FooId { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I have some list of things (typically IDs) that I want to do work on. | |
var fooIds = fooObjects.Select(f => f.FooId).ToList(); | |
// #1 | |
// This is my preference, because it's easier (for me) to spot the fact that we are taking some kind of important action. | |
// Examples 2 and 3 are easier to mis-read. At first glance I read them as somehow querying/filtering/modifying the list | |
// of ids, instead of as taking some kind of action on them. | |
foreach (var fooId in fooIds) | |
{ | |
teamService.NotifyFooChanged(fooId); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jons-MacBook-Air-2:gitstats jondokulil$ netstat -rn | |
Routing tables | |
Internet: | |
Destination Gateway Flags Refs Use Netif Expire | |
default utun0 UCS 24 0 utun0 | |
default 10.0.1.1 UGScI 9 0 en0 | |
10.0.1/24 link#8 UCS 0 0 utun0 | |
10.0.1.1 b8:8d:12:57:f4:44 UHLSr 6 10 en0 | |
10.0.1.108 127.0.0.1 UHS 0 0 lo0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var _sf_async_config={uid:@uid,domain:@domain,useCanonical:true}; | |
(function(){ | |
function loadChartbeat() { | |
window._sf_endpt=(new Date()).getTime(); | |
var e = document.createElement('script'); | |
e.setAttribute('language', 'javascript'); | |
e.setAttribute('type', 'text/javascript'); | |
e.setAttribute('src', '//static.chartbeat.com/js/chartbeat.js'); | |
document.body.appendChild(e); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var solr = SolrProxy.GetConnection<IndexedClip>(); | |
var field = new SolrQueryByField("d_OFF FORM", "Pro"); | |
var options = new QueryOptions { | |
Facet = new FacetParameters { Queries = new[] { | |
new SolrFacetQuery(new SolrQueryByRange<int>("dist", 0, 3)), | |
... | |
new SolrFacetQuery(new SolrQueryByRange<string>("dist", "10", "*")) | |
} } | |
}; | |
var results = solr.Query(field, options); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OnAppStartup() | |
{ | |
ConnectionFactory = new ConnectionFactory() | |
{ | |
HostName = "localhost", | |
Port = 5672, | |
UserName = "myapp", | |
Password = "password", | |
RequestedHeartbeat = 4, // heartbeat is what lets your code detect problems communicating with | |
// the RabbitMQ server. A heartbeat of 4 will cause the server to send |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void InitializeRabbitConnection() | |
{ | |
ConnectionFactory = new ConnectionFactory() | |
{ | |
HostName = "localhost", | |
Port = 5672, | |
UserName = "myapp", | |
Password = "password", | |
RequestedHeartbeat = 4, // heartbeat is what lets your code detect problems communicating with | |
// the RabbitMQ server. A heartbeat of 4 will cause the server to send |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Publisher { | |
private IModel _model; | |
public Publisher(IConnection conn, string queueName) { | |
_model = conn.CreateModel(); | |
// it's safe to declare queues that already exist as long as their properties are identical | |
// this runs on initialization every time - that will ensure all of your queues exist on app startup | |
model.QueueDeclare(queueName, true, false, false, null); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Consumer { | |
private IModel _model; | |
private QueueingBasicConsumer _queue; | |
public Consumer(IConnection conn, string queueName) { | |
_model = conn.CreateModel(); | |
_model.BasicQos(0, 50, false); // setting a per-channel prefetch can help with your overall throughput. See | |
// http://www.rabbitmq.com/blog/2012/04/25/rabbitmq-performance-measurements-part-2/ | |
// for more info. | |
OlderNewer