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
use futures::future::{lazy, try_join_all, Future, RemoteHandle}; | |
use futures::task::SpawnExt; | |
pub trait SpawnFuture { | |
fn spawn_future<T, E, F>(&mut self, f: F) -> RemoteHandle<Result<T, E>> | |
where | |
T: Send + 'static, | |
E: Send + 'static, | |
F: FnOnce() -> Result<T, E> + Send + 'static; | |
} |
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
Main> parse json "\"hello world!\n\"" | |
[(JsString "hello world!\n","")] | |
Main> parse json "true" | |
[(JsBoolean True,"")] | |
Main> parse json "false" | |
[(JsBoolean False,"")] |
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
--- Using a monad to implement the evaluation example but this time using "do" | |
import Control.Applicative | |
import Control.Monad | |
data Expr = C Float | | |
Expr :+ Expr| | |
V String | | |
Let String Expr Expr | | |
Read |
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
#/******************************************************************************* | |
#* Portions Copyright (C) 2007 Novell, Inc. All rights reserved. | |
#* | |
#* Redistribution and use in source and binary forms, with or without | |
#* modification, are permitted provided that the following conditions are met: | |
#* | |
#* - Redistributions of source code must retain the above copyright notice, | |
#* this list of conditions and the following disclaimer. | |
#* | |
#* - Redistributions in binary form must reproduce the above copyright notice, |
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
[~]$ /usr/sbin/ab -n 1000 -c 100 http://127.0.0.1:8000/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Server Software: breeze/0.1.0 | |
Server Hostname: 127.0.0.1 | |
Server Port: 8000 | |
Document Path: / |
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
#lang racket | |
(require web-server/http | |
web-server/managers/none | |
web-server/servlet | |
web-server/servlet-env) | |
(provide interface-version manager star-polling-app) | |
(define interface-version 'v2) |
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
(load-file "./watch_service.clj") | |
(refer 'watch-service) | |
(defn print-ev | |
[ev ctx] | |
(println "[foo]" ev " --> " ctx) | |
(println "Parent Dir:" (.getParent ctx))) | |
(defn print-ev-2 | |
[ev ctx] |
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
2012-10-26 17:12:28 | |
Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.8-b03 mixed mode): | |
"Attach Listener" daemon prio=10 tid=0x00007fa790001000 nid=0x428e waiting on condition [0x0000000000000000] | |
java.lang.Thread.State: RUNNABLE | |
================================= Suspicious DestroyJavaVM thread ================================ | |
"DestroyJavaVM" prio=10 tid=0x00007fa7b8007800 nid=0x425c waiting on condition [0x0000000000000000] | |
java.lang.Thread.State: RUNNABLE | |
================================================================================================= |
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
public class PrintAB { | |
// The code below would print overlapped A and B sequences like: | |
// ... | |
// A | |
// A | |
// B | |
// B | |
// ... | |
// |