updated_at
: update timepk
(guid) : identifier which is unique belong all devices.is_active
(is_deleted)is_conflicted
(transient, default=false)
updated_at
: the same as server side
def _generate_cache_key(request, headerlist, key_prefix): | |
"""Returns a cache key from the headers given in the header list.""" | |
ctx = md5_constructor() | |
for header in headerlist: | |
value = request.META.get(header, None) | |
if value is not None: | |
ctx.update(value) | |
path = md5_constructor(iri_to_uri(request.path)) | |
cache_key = 'views.decorators.cache.cache_page.%s.%s.%s' % ( | |
key_prefix, path.hexdigest(), ctx.hexdigest()) |
Players = new Meteor.Collection("players") | |
if Meteor.is_client | |
Template.leaderboard.players = () -> | |
return Players.find {}, {sort: {score: -1, name: 1}} | |
Template.leaderboard.selected_name = () -> | |
player = Players.findOne(Session.get("selected_player")); | |
return player and player.name |
def create(self): | |
while True: | |
self._session_key = self._get_new_session_key() | |
try: | |
self.save(must_create=True) | |
except CreateError: | |
continue | |
self.modified = True | |
return |
<html> | |
<head> | |
<title>guest's Firebase Project</title> | |
<script type='text/javascript' src='http://static.firebase.com/demo/firebase.js'></script> | |
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script> | |
<link rel='stylesheet' type='text/css' href='http://www.firebase.com/css/example.css'> | |
</head> | |
<body> | |
<div id='messagesDiv'></div> | |
<input type='text' id='nameInput' placeholder='Name'> |
// Node.h | |
class Node { | |
String name; //id | |
Node** children; | |
Node* parent; | |
int numOfChildren; | |
String* nameList; | |
int layernum; |
codes = {} | |
def convert(tag): | |
return codes.setdefault(tag, 1 << codes.length) | |
def desc(node): | |
for child in node.childs: | |
child_code = convert(child.tag) | |
child.code = child_code | node.code |
原題:Dynamo: Amazon’s Highly Available Key-value Store
原文: Amazon's Dynamo - All Things Distributed (PDF Version)
This article is translated by @ono_matope. Please contact me if any problem.
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<script type="text/javascript"> | |
'use strict'; | |
var a, b, c, e, f, fnc; | |
a = function(){ |
mixin with(val) | |
<!-- ko with: !{val} --> | |
block | |
<!-- /ko --> | |
mixin if(val) | |
<!-- ko if: !{val} --> | |
block | |
<!-- /ko --> |