Used nodes:
Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux
Linux localhost.localdomain 4.14.5-200.fc26.x86_64 #1 SMP Mon Dec 11 16:29:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
# sample implementation for http://stackoverflow.com/questions/37851053/django-query-group-by-month#new-answer | |
from __future__ import unicode_literals | |
from django.db import models | |
from django.db.models import Func, F, Sum | |
from django.db.transaction import atomic, rollback | |
from django.utils.timezone import now | |
class Invoice(models.Model): |
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
from urllib.parse import urlparse | |
import codecs | |
from django.conf import settings | |
from django.utils.html_parser import HTMLParser | |
__author__ = 'Paweł Krawczyk' |
class TestStaticSitePaths(TestCase): | |
def setUp(self): | |
self.root_page = Page.objects.get(id=1) | |
# For simple tests | |
self.home_page = self.root_page.add_child(instance=SimplePage(title="Homepage", slug="home")) | |
self.about_page = self.home_page.add_child(instance=SimplePage(title="About us", slug="about")) | |
self.contact_page = self.home_page.add_child(instance=SimplePage(title="Contact", slug="contact")) | |
# For custom tests |
# install openjdk | |
sudo apt-get install openjdk-7-jdk | |
# download android sdk | |
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz | |
tar -xvf android-sdk_r24.2-linux.tgz | |
cd android-sdk-linux/tools | |
# install all sdk packages |
This face-boxer.py script is more-or-less the same code that you'll find in the OpenCV tutorial: Face Detection using Haar Cascades. For another variation, with more explanation, check out RealPython's tutorial.
The face-boxer.py
script is designed to be run from the command-line. It has two required arugments:
(function(window, document, version, callback) { | |
var j, d; | |
var loaded = false; | |
if (!(j = window.jQuery) || version > j.fn.jquery || callback(j, loaded)) { | |
var script = document.createElement("script"); | |
script.type = "text/javascript"; | |
script.src = "/media/jquery.js"; | |
script.onload = script.onreadystatechange = function() { | |
if (!loaded && (!(d = this.readyState) || d == "loaded" || d == "complete")) { | |
callback((j = window.jQuery).noConflict(1), loaded = true); |
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
-- Firstly, remove PRIMARY KEY attribute of former PRIMARY KEY
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;
-- Then change column name of your PRIMARY KEY and PRIMARY KEY candidates properly.
ALTER TABLE <table_name> RENAME COLUMN <primary_key_candidate> TO id;