Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
/*! | |
* jQuery TextChange Plugin | |
* http://www.zurb.com/playground/jquery-text-change-custom-event | |
* | |
* Copyright 2010, ZURB | |
* Released under the MIT License | |
*/ | |
(function ($) { | |
$.event.special.textchange = { |
'''Manager-based polymorphic model inheritance. | |
This module provides a non-intrusive approach for accessing polymorphically | |
instances of a model hierarchy. Non-intrusive means: | |
- It does not require extending a custom ``Model`` base class or metaclass. | |
- It does not require a ``ForeignKey`` to ``ContentType`` or the ``contenttypes`` | |
app in general. Instead the real class of an instance is determined based on | |
the value (**polymorphic identity**) of a user-specified discriminating field | |
(**polymorphic on**). | |
- It does not override the default (or any other) model ``Manager`` (unless |
from django.db import connection | |
from django.utils.log import getLogger | |
logger = getLogger(__name__) | |
class QueryCountDebugMiddleware(object): | |
""" | |
This middleware will log the number of queries run | |
and the total time taken for each request (with a | |
status code of 200). It does not currently support |
# this forces dpkg not to call sync() after package extraction and speeds up install | |
RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup | |
# we don't need and apt cache in a container | |
RUN echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache |
class DisableMigrations(object): | |
def __contains__(self, item): | |
return True | |
def __getitem__(self, item): | |
return "notmigrations" | |
MIGRATION_MODULES = DisableMigrations() |
import scalaz.\/ | |
import scalaz.syntax.either._ | |
object Example2 { | |
// This example simulates error handling for a simple three tier web application | |
// | |
// The tiers are: | |
// - the HTTP service | |
// - a user authentication layer | |
// - a database layer |
import subprocess | |
import pytest | |
class Interpreter(object): | |
base = '/usr/bin/python' | |
def __init__(self, suffix): | |
self.suffix = suffix |
The aim was to be able to: