Общяя информация:
This file contains 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
/* | |
Copyright 2017 Hidetake Iwata | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x
A nicer Terminal experience.
Just add the following to your bash profile.
export PS1='\[\033[38;5;202;48;5;0m\]⏣ \[\033[38;5;134;48;5;0m\]\w \[\033[38;5;112;48;5;0m\]`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\[\033[00m\]'
(The green bit there is the current branch you're on if you're in a directory that has a git repository within it)
This file contains 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.{Try, Success, Failure} | |
def f(s: String): Try[Int] = Try { s.toInt } | |
def g(i: Int): Try[Int] = Try { i * 2 } | |
def unit[T](v: T): Try[T] = Success(v) | |
//val v = "1" | |
val v = "bad" | |
val m = Success(v) |
This file contains 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 java.io.IOException; | |
import java.util.BitSet; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.Map; | |
public class LZSS { | |
public static class LZSSData{ |
This file contains 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
/** | |
* Returns a free port number on localhost. | |
* | |
* Heavily inspired from org.eclipse.jdt.launching.SocketUtil (to avoid a dependency to JDT just because of this). | |
* Slightly improved with close() missing in JDT. And throws exception instead of returning -1. | |
* | |
* @return a free port number on localhost | |
* @throws IllegalStateException if unable to find a free port | |
*/ | |
private static int findFreePort() { |
This file contains 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
/** | |
* D Holbrook | |
* | |
* Code Club: PO1 | |
* | |
* (*) Define a binary tree data structure and related fundamental operations. | |
* | |
* Use whichever language features are the best fit (this will depend on the language you have selected). The following operations should be supported: | |
* | |
* Constructors |
This file contains 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
Setting the hibernate.show_sql to true tells hibernate to Write all SQL statements to console. This is an alternative to setting the log category org.hibernate.SQL to debug. | |
So even if you set this property to false, make sure that you don't have the following category defined (or configured to use a console appender): | |
log4j.logger.org.hibernate.SQL=DEBUG | |
Also, make sure that you don't set the hibernate.show_sql programmatically to true when instancing your Configuration object. Hunt something like this: | |
Configuration cfg = new Configuration().configure(). | |
.setProperty("hibernate.show_sql", "true"); | |
Note that the setProperty(String propertyName, String value) takes as first parameter the full name of a configuration property i.e. hibernate.show_sql, not just show_sql. |