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
AssertionError at /api/1.0/product | |
Expected view ProductViewSet to be called with a URL keyword argument named "pk". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly. | |
Request Method: OPTIONS | |
Request URL: http://localhost:8000/api/1.0/product | |
Django Version: 1.7 | |
Exception Type: AssertionError | |
Exception Expected view ProductViewSet to be called with a URL keyword argument named "pk". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly. |
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
from rest_framework import routers, serializers, viewsets | |
from django.conf.urls import url, include | |
from core.views import * | |
class BatchRouter(routers.DefaultRouter): | |
routes = [ | |
routers.Route( | |
url=r'^{prefix}{trailing_slash}$', | |
mapping={ | |
'post': 'batch_create', |
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
case class Node { | |
val connections: ListBuffer[Connection] = new ListBuffer[Connection] | |
} | |
case class Connection( | |
from: Node, | |
val to: Node, | |
val cost: Int, | |
private val directed: Boolean = true | |
) { |
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
import blogimplicits._ | |
class BlogCtrl(db: Database) extends RestFullCtrl(Blogs, db) { | |
def parseId(s: String) = s.toInt | |
override val deserializer: PartialFunction[JValue, Blog] = { | |
case jobj:JObject => (jobj ~ ("author_id", 1)) | |
.extract[Blog](defaultFormats, implicitly[Manifest[Blog]]) | |
} | |
} |
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
package nl.ncim.alc.models | |
import aj.slick.auth._ | |
trait EndpointComponent { this: ActiveSlick => { | |
import jdbcDriver.simple._ | |
case class Endpoint( | |
id: Option[Int], | |
mac_address: String |
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
## | |
## Put me in ~/.irssi/scripts, and then execute the following in irssi: | |
## | |
## /load perl | |
## /script load notify | |
## | |
use strict; | |
use Irssi; | |
use vars qw($VERSION %IRSSI); |
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
## | |
## Put me in ~/.irssi/scripts, and then execute the following in irssi: | |
## | |
## /load perl | |
## /script load notify | |
## | |
use strict; | |
use Irssi; | |
use vars qw($VERSION %IRSSI); |
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
import scala.util.Random | |
object Main { | |
type Board = List[List[Int]] | |
def main(argv: Array[String]) = { | |
val size: (Int, Int) = (80, 80) | |
val bombs = 250 |
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
--- | |
title: Assignment 6 | |
author: | |
- Arjen Rouvoet | |
--- | |
## 1: Weighted Max-SAT | |
It's trivial to perform this parallel to the proof in the book. | |
Let $Z_i$ be a random variable indicating whether clause $i$ is satisfied ($Z_i$ is $1$ if $i$ is |
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
using System; | |
using System.Collections.Generic; | |
namespace System.Reactive | |
{ | |
public static class Observable | |
{ | |
/// <summary> | |
/// Creates an observable sequence object from the specified subscription function. | |
/// </summary> |