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 scipy.sparse import csr_matrix | |
import scipy as sp | |
import numpy as np | |
from scipy.sparse.linalg import spsolve_triangular | |
# rating matrix | |
a = np.array([[1, 0, 1, 1, 0], | |
[1, 1, 0, 1, 0], | |
[1, 0, 0, 1, 0]]) |
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
/** | |
* A simple sample of Boost Log | |
*/ | |
#pragma warning(push) | |
#pragma warning(disable:4819) | |
# include <boost/shared_ptr.hpp> | |
# include <boost/date_time/posix_time/posix_time_types.hpp> | |
# include <boost/log/trivial.hpp> | |
# include <boost/log/core.hpp> |
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
class TableCell(object): | |
bg_colour = None | |
def __init__(self, value, header=False, bg_colour=None, text_colour=None): | |
self.value = value | |
self.header = header | |
self.bg_colour = bg_colour | |
self.text_colour = text_colour | |
def _make_css(self): |
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
@(page:Int, pageLength:Int, collectionLength:Int, route:Int => Call, bound:Int = 5) | |
@lowbound() = @{ | |
((page.toDouble / bound).floor * bound) toInt | |
} | |
@highbound() = @{ | |
if ((lowbound() + bound) * pageLength >= collectionLength) | |
collectionLength / pageLength + 1 | |
else | |
lowbound() + bound | |
} |
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 mojolly.io | |
import org.jboss.netty.bootstrap.ClientBootstrap | |
import org.jboss.netty.channel._ | |
import socket.nio.NioClientSocketChannelFactory | |
import java.util.concurrent.Executors | |
import org.jboss.netty.handler.codec.http._ | |
import collection.JavaConversions._ | |
import websocketx._ | |
import java.net.{InetSocketAddress, URI} |