- Tatsuhiro Ujihisa
- http://ujihisa.blogspot.com/
- 非同期とは?
- スレッド、プロセス
- プロセス生成
| /* | |
| * BPGeometry.h | |
| * | |
| * Created by Jon Olson on 11/30/09. | |
| * Copyright 2009 Ballistic Pigeon, LLC. All rights reserved. | |
| * | |
| */ | |
| #import <Foundation/Foundation.h> |
| check host mongodb with address localhost | |
| start program = "/usr/bin/sudo /opt/database/mongo/bin/mongod" | |
| stop program = "/usr/bin/sudo /usr/bin/pkill -f mongod" | |
| if failed port 28017 protocol HTTP | |
| request / | |
| with timeout 10 seconds | |
| then start |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title> | |
| <script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script> | |
| <script type="text/javascript" charset="utf-8"> | |
| $(function () { | |
| var extractToken = function(hash) { |
| require 'sinatra/base' | |
| class MyApp < Sinatra::Base | |
| @@my_app = {} | |
| def self.new(*) self < MyApp ? super : Rack::URLMap.new(@@my_app) end | |
| def self.map(url) @@my_app[url] = self end | |
| class FooController < MyApp | |
| map '/foo' |
| require 'rack' | |
| class App | |
| def call(env) | |
| to = Rack::Request.new(env).params["to"] || "World" | |
| body = Rack::Utils.escape_html(to) | |
| [200, {"Content-Type" => "text/html"}, [body]] | |
| end | |
| end |
By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.