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
| #include <WindowsConstants.au3> | |
| Global $SS_CENTER | |
| $_GuiCountDown = GUICreate ( "CountDown...", 500, 200, @DesktopWidth/2 +200, @DesktopHeight/2 +100, $WS_EX_TOPMOST ) | |
| GUISetBkColor ( 0xCCCCCC ) | |
| $TimeLabel = GUICtrlCreateLabel ( "", 35, 0, 400, 180, $SS_CENTER ) |
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
| def remove(id: String) = Action { implicit request => | |
| // user match { | |
| // case Some(u) => { | |
| // Users.remove(id) | |
| // Redirect(routes.Application.index()).flashing("message" -> "User Deleted!") | |
| // } | |
| // case None => { | |
| // Redirect(routes.Application.index()).flashing("message" -> "You can't do that! You're a bad perosn") | |
| // } | |
| // } |
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
| val memo = HashMap[(Int, Int), (Int, Int)]((0, 0) -> (0, 0)) | |
| def cost(from: Int, to: Int): (Int, Int) = { | |
| if (memo.contains((from, to))) { | |
| memo((from, to)) | |
| } else if (to - from < 1) { | |
| (to, 0) | |
| } else if (to - from < 3) { | |
| (Math.max(0, to - 1), Math.max(0, to - 1)) | |
| } else { | |
| val costList = (from to to).map(i => (Math.max(cost(from, i - 1)._2, cost(i + 1, to)._2) + i)) |
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
| object Tree { | |
| private var current = 0 | |
| def inc = { current += 1; current } | |
| def elements = current | |
| } | |
| class Tree { | |
| var root: Node = new Node(Tree.inc) |
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
| def regulaFalsi(eps:Double)(from:Double, to:Double, f: Double => Double) : Double = { | |
| var i = 1000 | |
| var a = from | |
| var fa = f(a) | |
| var b = to | |
| var fb = f(b) | |
| var c = a - fa * (b-a)/(fb-fa) | |
| var fc = f(c) | |
| while (abs(fc)>eps && b-a > eps && {i-=1;i} > 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
| def combinations(occurrences: Occurrences): List[Occurrences] = { | |
| def combo(l: Occurrences): List[Occurrences] = { | |
| l match { | |
| case Nil => List() | |
| case occurrence :: tail => { | |
| val rest = combo(tail) | |
| val occurrenceList = (1 to occurrence._2).map( num => List( (occurrence._1,num) )).toList | |
| occurrenceList ::: occurrenceList.flatMap(x => rest.map(y => x ::: y).toList).toList ::: rest | |
| } | |
| } |
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 java.util.LinkedList; | |
| public class LevenshteinDistance { | |
| public static final int NONE = 0; | |
| public static final int DELETE = 1; | |
| public static final int INSERT = 2; | |
| public static final int CHANGE = 3; | |
| private static int minimum(int a, int b, int c) { |
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 EditDistance { | |
| /** | |
| * @param args | |
| */ | |
| public static void main(String[] args) { | |
| int[] a = LevenshteinDistance.getOperations("aa", "aac"); | |
| for (int i = 0; i < a.length; i++) { | |
| System.out.println(a[i]); |
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 test; | |
| public class Test { | |
| /** | |
| * @param args | |
| */ | |
| public static void main(String[] args) { | |
| // TODO Auto-generated method stub |
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
| zidar@haxor ~/programming/myproject | |
| $ cat test.py | |
| from flask import Flask | |
| import flask | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def hello_world(): | |
| return str(flask.app.request) |
OlderNewer