http://guides.rubyonrails.org/association_basics.html
- belongs_to : TABLE_NAME
- has_one : TABLE_NAME [:through => :TABLE_NAME]
- has_many : TABLE_NAME [:through => :TABLE_NAME]
- has_and_belongs_to_many : TABLE_NAME [:join_table => :TABLE_NAME]
var http = require('http'), express = require('express'), redis = require('redis'), RedisStore = require('connect-redis')(express); var redisClient = redis.createClient( 17969, '<redacted>.garantiadata.com', { auth_pass: '<redacted>' } ); var app = express(); app.use(express.cookieParser('pure cat flight grass')); app.use(express.session({ store: new RedisStore({ client: redisClient }) })); app.use(express.urlencoded()); app.use(app.router); app.get('/', function(req, res){ var html = ''; if(req.session.name) html += '<p>Welcome, ' + req.session.name + '.</p>'; html += '<form method="POST"><p>Name: ' + '<input type="text" name="name"> ' + '<input type="submit"></p></form>'; res.send(html); }); app.post('/', function(req, res){ req.session.name = req.body.name; res.redirect('/'); }); http.createServer(app).listen(3000,function(){ console.log('listening on 3000'); }); | |
I'm using a free Redis account from Garantia Data, not that that should make a difference. Do you spot any differences between what I'm doing an |
#! /usr/bin/bash | |
xrandr --newmode "1904x950_60.00" 149.25 1904 2016 2216 2528 950 953 963 986 -hsync +vsync | |
xrandr --addmode VBOX0 "1904x950_60.00" |
PS1="\[\e[1;36m\]\u\[\e[0m\]\[\e[1;37m\]|\[\e[1;31m\]\h \[\e[1;32m\][\W \$?]: $ \[\e[0m\]" | |
alias subt='~/Downloads/Sublime\ Text\ 2/sublime_text' | |
WORK_HOME='~/.venvs' | |
source /usr/local/bin/virtualenvwrapper.sh | |
source /usr/local/rvm/scripts/rvm | |
export TERM="xterm-256color" |
http://guides.rubyonrails.org/association_basics.html
def main(): | |
StNumber, StMark = input('Enter student number and student mark separated by a comma') | |
StNumber = StNumber.upper() | |
if len(StNumber)==9 and StNumber[0:6].isalpha() and StNumber[6:].isdigit(): | |
with open("output.txt", "w") as f: | |
f.write(StNumber + "," + StMark + "\n") | |
else: | |
print("Invalid student number") |
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
@charset "UTF-8"; | |
/* CSS Document */ | |
.span2{ | |
height: 30px; | |
width: 150px; | |
} |
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
@charset "UTF-8"; | |
/* CSS Document */ | |
.span2{ | |
height: 30px; | |
width: 150px; | |
} |
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
@charset "UTF-8"; | |
/* CSS Document */ | |
.span2{ | |
height: 30px; | |
width: 150px; | |
} |
from requests import get | |
import sys | |
def do_sth: | |
print('Hello World !') |
class VideoList(ListView): | |
model = Video | |
paginate_by = 15 | |
template_name = "vid_index.html" | |
context_object_name = "vid_list" | |
def get_context_data(self, **kwargs): | |
context = super(VideoDetail, self).get_context_data(**kwargs) | |
context['big_video'] = Video.objects.filter(id=1) | |
# Iterate over vid_list in templates for |