This is a simple chat-like program using pub-sub pattern, backed by PostgreSQL's LISTEN/NOTIFY command.
publish message to foo
channel from user nickname
.
$ python pub.py foo nickname
PUBLISH to channel #foo
print "hello" |
// | |
// LinkedTextView.h | |
// | |
// Created by Benjamin Bojko on 10/22/14. | |
// Copyright (c) 2014 Benjamin Bojko. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
/** |
// code not guaranteed to work!!!! never ran it | |
// On the server | |
Meteor.publish("myData", { | |
var subscription = this; | |
var data = HTTP.call("https://reddit.com/r/funny.json").data.children; | |
data.forEach(function (item) { | |
subscription.added("my-collection", item); | |
}); |
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.example</groupId> | |
<artifactId>my-project</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<dependencies> | |
<!-- none yet --> |
var express = require('express'); | |
var http = require('http'); | |
var app = express(); | |
// Simple user controller implementation. | |
var users = [ | |
{ username: 'jamsesso', age: 20, gender: 'M' }, | |
{ username: 'bettycrocker', age: 20, gender: 'F' } | |
]; |
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.
// swift Package.swift | |
import PackageDescription | |
let package = Package( | |
name: "demo-pgsql", | |
dependencies: [ | |
.Package(url: "https://github.com/PerfectlySoft/Perfect-PostgreSQL.git", majorVersion: 2, minor: 0) | |
] | |
) |
如果你的iOS项目项目中要使用zmq,那么肯定会涉及到以下问题:
download the POSIX tarball from zeromq web site
uncompress the tarball
The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.
However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on