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]
/** | |
* Implementation of {@link EventService} which connects and disconnects to the server. | |
* It also sends and receives events from the server. | |
*/ | |
public class EventServiceImpl implements EventService { | |
private static final String TAG = EventServiceImpl.class.getSimpleName(); | |
private static final String SOCKET_URL = "https://socket-io-chat.now.sh"; | |
private static final String EVENT_CONNECT = Socket.EVENT_CONNECT; | |
private static final String EVENT_DISCONNECT = Socket.EVENT_DISCONNECT; |
/** | |
* Service layer that connects/disconnects to the server and | |
* sends and receives events too. | |
*/ | |
public interface EventService { | |
void connect(String username) throws URISyntaxException; | |
void disconnect(); |
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="daichan4649.lockoverlay" | |
android:versionCode="1" | |
android:versionName="1.0" > | |
<uses-sdk | |
android:minSdkVersion="15" | |
android:targetSdkVersion="17" /> |
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") |
http://guides.rubyonrails.org/association_basics.html
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" |
set t_Co=256 | |
set pastetoggle=<F8> | |
colorscheme wombat256mod | |
set hlsearch | |
set tabstop=4 | |
set softtabstop=4 | |
set shiftwidth=4 | |
let g:indent_guides_auto_colors=0 | |
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3 | |
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4 |
#! /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" |
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 |
/* The API controller | |
Exports 3 methods: | |
* post - Creates a new thread | |
* list - Returns a list of threads | |
* show - Displays a thread and its posts | |
*/ | |
var Thread = require('../models/thread.js'); | |
var Post = require('../models/post.js'); |