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
from gearman import GearmanClient | |
from gearman.task import Task | |
JOB_SERVER = ['127.0.0.1:4730'] | |
if __name__ == '__main__': | |
client = GearmanClient(JOB_SERVER) | |
ret3 = client.do_task(Task("hello","task...",timeout=1)) | |
print ret3 | |
ret = client("hello","world") |
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
<script type="text/javascript" src="./right-src.js"></script> | |
<script type="text/javascript" src="./history.right.js"></script> | |
<script type="text/javascript"> | |
var observer = new Observer(); | |
observer.observe('change', function(hash) { | |
alert(hash); | |
}); | |
var aHistory = new History({ |
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
#1. 딕셔너리 만들때 | |
key = (1,2,3,4,5) | |
value =('a','b','c','d','e') | |
b = zip(key,value) | |
print b | |
> { 1 : "a" , 2 : "b" } | |
print b[1] | |
> "a" | |
#2. 문자 포맷팅. |
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
scala> def a(x : => Unit) { print("a") } | |
a: (x: => Unit)Unit | |
scala> a { | |
| print("b") | |
| } | |
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
scala> import dispatch._ | |
import dispatch._ | |
scala> import Http._ | |
import Http._ | |
scala> import json.Js._ | |
import json.Js._ | |
scala> import twitter._ |
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 twitter4j._ | |
val listener = new StatusListener { | |
override def onStatus(status:Status) { | |
println(status.getText) | |
} | |
override def onDeletionNotice(notice : StatusDeletionNotice) {} | |
override def onTrackLimitationNotice(numOfLimitStatues : Int) {} | |
override def onException(ex : Exception) { ex.printStackTrace } | |
} |
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
scala> import net.liftweb.mongodb._ | |
import net.liftweb.mongodb._ | |
scala> import org.bson.types.ObjectId | |
import org.bson.types.ObjectId | |
scala> MongoDB.defineDb(HFDB, MongoAddress(MongoHost("localhost", 27017), "hotflow")) | |
scala> import models._ | |
import models._ |
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
val db = MongoDB("hotflow") | |
db('post) < ("postId" -> 1212 ) :: ("post" -> "text" ) :: ("username" -> "anarcher") :: Nil | |
db 'post ? ("postId" -> 121) | (0,10) | |
db('post).find( ("postId" -> 121) ).limit(10).offset(0) | |
db.getMongoDb | |
db.getCollection("post") |
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
임의의 알파벳 시퀀스를 입력받아서, 해당 알파벳으로 만들 수 있는 순서의 조합을 모두 구한다. | |
결과는 문자열의 오름차순으로 정렬하려 출력한다. 예를 들어, "AB", "BA" 가 있는 경우 "AB"가 "BA"보다 먼저 나와야 한다. | |
ex) | |
"ABC" -> "ABC", "ACB", "BAC", "BCA", "CAB", "CBA" | |
"AAB" -> "AAB", "ABA", "BAA" | |
"ABA" -> "AAB", "ABA", "BAA" | |
"000" -> "000" |
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 com.google.appengine.api.urlfetch._ | |
import java.net.URL | |
import java.net.URLEncoder | |
val urlFetch = URLFetchServiceFactory.getURLFetchService() | |
val url = new URL("http://me2day.net/api/get_posts/anarch.json") | |
val req = new HTTPRequest(url,HTTPMethod.GET) | |
val params = Map("scope" -> "all") | |
val qs = Map(params : _* ).foldLeft("")((qs,p) => { (if(qs != "") qs+"&" else qs)+"%s=%s".format(p._1,p._2) }) | |
req.setPayload(qs.getBytes) |
OlderNewer