Skip to content

Instantly share code, notes, and snippets.

View chriswk's full-sized avatar
🖥️
coding @Unleash

Christopher Kolstad chriswk

🖥️
coding @Unleash
View GitHub Profile
@chriswk
chriswk / output
Last active August 29, 2015 13:56
main:
[mkdir] Created dir: /Users/chrkolst/src/finn/mods/objectrelation-management/objectrelation-api/target/generated-sources
[echo] Using thrift-0.9.1
[apply] Scanning /Users/chrkolst/src/finn/mods/objectrelation-management/objectrelation-api/src/main/thrift/objectrelation-thrift-api.thrift for includes
[apply] Parsing /Users/chrkolst/src/finn/mods/objectrelation-management/objectrelation-api/src/main/thrift/objectrelation-thrift-api.thrift for types
[apply] Program: /Users/chrkolst/src/finn/mods/objectrelation-management/objectrelation-api/src/main/thrift/objectrelation-thrift-api.thrift
[apply] Generating "java:beans,hashcode"
[apply] Scanning /Users/chrkolst/src/finn/mods/objectrelation-management/objectrelation-api/src/main/thrift/objectrelation-thrift-api.thrift for includes
[apply] Parsing /Users/chrkolst/src/finn/mods/objectrelation-management/objectrelation-api/src/main/thrift/objectrelation-thrift-api.thrift for types
[apply] Program: /Users/chrkolst/src/finn/mo
public double getStars() {
Iterable<Rating> allRatings = ratings;
if (allRatings == null) return 0;
int stars = 0, count = 0;
for (Rating rating : allRatings) {
stars += rating.getStars();
count++;
}
return count == 0 ? 0 : stars / count;
ImmutableList<String> filters = FluentIterable
.from(taxonomyFieldConfig.getTaxonomyLevelConfigs())
.transformAndConcat(new Function<TaxonomyLevelConfig, List<String>>() {
public List<String> apply(TaxonomyLevelConfig taxonomyLevelConfig) {
List<String> filters = new ArrayList<>();
if (parameters.containsKey(taxonomyLevelConfig.getLegacyParameterName())) {
for(String value : parameters.get(taxonomyLevelConfig.getLegacyParameterName())) {
filters.add(taxonomyLevelConfig.getFilterPrefix() + value + taxonomyLevelConfig.getFilterSuffix());
}
}
private ImmutableList<IPoi> convertResultToPoisG(final String searchKey, final SearchServiceResult result) {
return FluentIterable
.from(result.getSearchResults().getResultItems())
.transform(new SearchResultToPoiBean(searchKey))
.filter(new MercatorFilter())
.transform(new Function<IadPoiBean, IPoi>() {
@Nullable
@Override
public IPoi apply(@Nullable IadPoiBean input) {
return input;
Your solution achieved a testing score of 250 out of 355.
Below you can see a short feedback for every test that failed, indicating the reason
for the test failure and how many points you lost for each individual test.
[Test Description] case1: Primary and secondaries must work in concert when persistence is unreliable
[Observed Error] java.lang.AssertionError: assertion failed: expected OperationAck(3), found OperationFailed(3)
[exception was thrown] detailed error message in debug output section below
[Lost Points] 35
[Test Description] case2: Primary and secondaries must work in concert when communication to secondaries is unreliable
@chriswk
chriswk / demux.md
Last active December 28, 2015 02:28
demux output
Output3
Input Control1 Control2 Control3 Output1 Output2
def buildOutput(controlCount: Int) = {
val f = Math.pow(2, controlCount).toInt
(1 to f).map(x => new Wire).toList
}
if (pbp.getDuration() > 0) {
setEndDate(null); // The stored procedure will figure out the end date given the product's duration
final DateMidnight today = new DateMidnight();
setStartDate(new Date(today.getMillis()));
} else {
if (adBean.getStartDate() != null) {
setStartDate(adBean.getStartDate());
} else {
final DateMidnight today = new DateMidnight();
setStartDate(new Date(today.getMillis()));
<li class="pvs">
<img src="http://logo.png" alt="FINN">
<span class="fright">
<button id="un-follow-org-container--3002" title="Avf�lg firma" type="submit" class="utility small" data-org-id="-3002" data-org-name="FINN" data-rel-type="JOB_USER_ORG_AFFINITY" data-followorg-id="un-follow-org-container--3002" data-r="followorg.showUnFollowDialog" style="display: none;">Du f�lger dette firmaet</button><button id="follow-org-container--3002" title="F�lg firma" type="submit" class="utility small" data-org-id="-3002" data-org-name="FINN" data-rel-type="JOB_USER_ORG_AFFINITY" data-followorg-id="follow-org-container--3002" data-r="followorg.followOrg" style="display: inline-block;">F�lg firma</button></span><span class="fright">FINN</span></li><li class="pvs"><img src="http://logo.png" alt="FINN"><span class="fright"><button id="un-follow-org-container--3002" title="Avf�lg firma" type="submit" class="utility small" data-org-id="-3002" data-org-name="FINN" data-rel-type="JOB_USER_ORG_AFFINITY" data-followorg-id=
@chriswk
chriswk / itsallaboutthecows
Created June 24, 2013 09:42
Cows for fun
Socialism: You have 2 cows and you give one to your neighbour.
Communism: You have 2 cows; the Government takes both and gives you some milk.
Fascism: You have 2 cows; the Government takes both and sells you some milk.
Nazism: You have 2 cows; the Government takes both and shoots you.
Bureaucratism: You have 2 cows; the Government takes both, shoots one, milks the other and throws the milk away..