The following rules of programming style are excerpted from the book "The Elements of Programming Style" by Kernighan and Plauger, published by McGraw Hill. Here is quote from the book: "To paraphrase an observation in The Elements of Style by Strunk and White, the rules of programming style, like those of English, are sometimes broken, even by the best writers. When a rule is broken, however, you will usually find in the program some compensating merit, attained at the cost of the violation. Unless you are certain of doing as well, you will probably do best to follow the rules."
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
-
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the
secure
flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection. -
Use production SSL certificates locally. This is annoying
# default to -j6 for make | |
FORCE_MAKE_JOBS=yes | |
MAKE_JOBS_NUMBER=6 | |
# specific options/etc for ports | |
.if ${.CURDIR:M*/databases/mysql*-server} | |
BUILD_OPTIMIZED=yes | |
.endif | |
# static zsh build for root |
There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.
So, these are the different settings we are going to compare:
- Go HTTP standalone (as the control group)
- Nginx proxy to Go HTTP
- Nginx fastcgi to Go TCP FastCGI
- Nginx fastcgi to Go Unix Socket FastCGI
# time ./do-all.sh | |
+ lvcreate -kn -s -n ubunt2 /dev/k2/ubunt | |
Logical volume "ubunt2" created | |
+ lvresize -L 40G /dev/k2/ubunt2 | |
Extending logical volume ubunt2 to 40.00 GiB | |
Logical volume ubunt2 successfully resized | |
+ echo -en 'd\nn\np\n\n\n\n\n\nw\nq\n' | |
+ fdisk /dev/k2/ubunt2 | |
Command (m for help): Selected partition 1 |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
package main | |
import ( | |
"net/http" | |
"database/sql" | |
"fmt" | |
"log" | |
"os" | |
) |
└──╼ cat device_chip.ads | |
-- | |
-- Copyright (C) 2014 Edward O'Callaghan <eocallaghan@alterapraxis.com> | |
-- | |
-- | |
-- Each Driver implements a concrete realisation of the Chip interface. | |
-- This constitutes a "Class" of Chips that are enumerated from the devicetree. | |
-- |
/** | |
* Q Promises implementation | |
* @module Q | |
*/ | |
(function (Q) { | |
/** | |
* Q.Promise constructor. | |
* Call the .fulfill(...) or .reject(...) method to | |
* signal that the promise is fulfilled or rejected. |
This is a reference of OpenGL functions by the state they affect. For example, glBindVertexBuffer acts on the bound Vertex Array Object. This wiki category is the only place I could find this data collected. Below I list each category that seems important and the functions within them.