| Models | Examples |
|---|---|
| Display ads | Yahoo! |
| Search ads |
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
| #! /usr/bin/env python | |
| import redis | |
| import random | |
| import pylibmc | |
| import sys | |
| r = redis.Redis(host = 'localhost', port = 6389) | |
| mc = pylibmc.Client(['localhost:11222']) |
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
| (ns messagepassing.core) | |
| (import [java.util.concurrent LinkedTransferQueue]) | |
| (def m 10000000) | |
| (defn queue-test [] | |
| (defn bounce [in out m] | |
| (let [value (.take in)] | |
| (if (< value m) | |
| (do |
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
| #! /usr/bin/env python | |
| import redis | |
| import random | |
| import pylibmc | |
| import sys | |
| r = redis.Redis(host = 'localhost', port = 6389) | |
| mc = pylibmc.Client(['localhost:11222']) |
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
| (defn chunked-string-seq | |
| ([^java.io.Reader rdr] | |
| (chunked-string-seq rdr :chunk-size 16)) | |
| ([^java.io.Reader rdr &{chunk-size :chunk-size}] | |
| {:pre [(some-> chunk-size pos?)]} | |
| (let [buf (char-array chunk-size)] | |
| (letfn [(f [] | |
| (when (pos? (.read rdr buf)) | |
| (cons (String. buf) (lazy-seq (f)))))] | |
| (f))))) |
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
| (ns wikiparse.core | |
| (:require [clojure.java.io :as io] | |
| [clojure.data.xml :as xml] | |
| [clojure.zip :refer [xml-zip]] | |
| [clojure.data.zip.xml :refer [xml-> xml1-> text]]) | |
| (:import [ org.apache.commons.compress.compressors.bzip2 BZip2CompressorInputStream]) | |
| (:gen-class :main true)) | |
| (defn bz2-reader | |
| "Returns a streaming Reader for the given compressed BZip2 |
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
| (ns queries.postgres | |
| (:gen-class) | |
| (:require [cascalog.ops :as c]) | |
| (:use [cascalog.api]) | |
| (:import [com.twitter.maple.jdbc JDBCTap JDBCScheme TableDesc] | |
| [cascading.tap.SinkMode])) | |
| (defn db-tap [table] | |
| (let [tap (com.twitter.maple.jdbc.JDBCTap. | |
| "jdbc:postgresql://my-db-uri?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory" |
Hey! I saw this has been indexed by the search engines. It is a first draft of a post I ended up publishing on my blog at: Scaling PostgreSQL With Pgpool and PgBouncer
Thanks for stopping by!
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
A hopefully short and concise explanation as to how Clojure deals with Objects. If you already write Clojure, this isn't for you.
You know what an Interface is if you write/read Java or PHP 5+. In Clojure it might be called defprotocol.
user> (defprotocol IABC
(also-oo [this])
(another-fn [this x]))IABC