2015-01-01から1年間の記事一覧

CHECK 制約 と ALTER TABLE tablename ADD CONSTRAINT

ALTER TABLE tablename ADD CONSTRAINT を 新規テーブルへ実行 ALTER TABLE 可能 CREATE TABLE projects ( projectname text NOT NULL, membernum integer NOT NULL ); ALTER TABLE projects ADD CONSTRAINT projects_membernum_check CHECK(membernum BETWE…

CHECK 制約

「アプリケーション層の validation は、不正値入力の『通知』に留め」 「データの整合性 はデータ層が担保しよう」 って Dan Chak さんが言ってた(覚えがあるので要復習) CREATE TABLE users ( name text NOT NULL, receivemailflag INTEGER NOT NULL DEFAU…

warning: circular argument reference

【追記】 よいまとめはこっち ↓ ruby2.2.0ではメソッドの引数のデフォルト値に同じ名前の変数を使えない - Qiitaqiita.com v2.1.6 > v2.2.2 の移行より 分かったこと test.rb 1 class SomeClass 2 attr_reader :text 3 4 def initialize 5 @text = 'test rea…

LEFT OUTER JOIN 内部処理(概説)(思念中)

DB

RIGHT もやることは変わらない LEFT OUTER JOIN の内部処理 CROSS JOIN で集合の組合せ(順列テーブル) を作成する ON 条件に合致する集合を ↑ から走査し、合致すればその集合を保持する 条件に合致しなければ(FALSE か UNKNOWN) [X] を実行 [X] 保存対象の…

INNER JOIN の内部処理(概説)

DB

INNER JOIN の内部処理 CROSS JOIN で集合同士の組合わせ(順列テーブル)を作成する ON 条件に合致する集合を ↑ から、一つ一つ走査する 条件合致した集合を抽出し、これを結果の集合とする 前提テーブルとデータ(RDBMS == PostgreSQL) CREATE TABLE vendors …

レプリケーション

負荷分散 楽しそう http://thinkit.co.jp/free/article/0603/10/4/

Struct ruby

(゚∀゚) $ irb > class Article < Struct.new(:title, :body) > end #=> nil > article = Article.new #=> #<struct Article title=nil, body=nil> > article.title = 'example' #=> "example" > article.body = 'example body' #=> "example body" > p article #<struct Article title="example", body="example body"> 参考 R…</struct></struct>

delayed_job rails

Delayed Job Best Practiceswww.sitepoint.com

Gemfile の グループ化, 明確にしないと予期せぬエラーが起きる (書き留め)

Gemfile のグループ化は明確にしよう、という話 お題のGemfile source 'https://rubygems.org' gem 'rails', '~> 4.2' gem 'sqlite3' gem 'coffee-rails', '~> 4.0.0' gem 'haml' gem 'jbuilder', '~> 2.0' gem 'jquery-rails' gem 'faraday' gem 'rails_con…

親クラスメソッドを子クラスへ継承できるかどうか

Ruby 2.2.2 できる class Some class << self def some_func p 'func!' end end end class Emos < Some end Emos.some_func #=> 'func!'

クエリパラメーターはいつ使うべきか

REST API Best practices: Where to put parameters?stackoverflow.com

コードで作成したボタンにイベントを付与, titleLabel を意図的に改行

何がしたいか UIButton をコードで作成し、UIViewController に addSubview で表示する 表示したボタン にイベントを付与する(addTarget で) の titleLabel を意図的に改行させる 前提 iOS 8.3 シミュレーター iPad Air 登場人物 ButtonsViewController(.xib…

Mac + 日本語キーボードでバックスラッシュを打ち込む時

option + エンマーク Macにおけるバックスラッシュ(\)の入力方法 - Qiitaqiita.com

連鎖参照整合性制約

DB

親テーブルと子テーブルがありました 親テーブルの外部キーで参照されるキーの値が変更(削除、更新)されました 子テーブルの参照するキーの値はどうしますか リンク参照 連鎖参照整合性制約

人口キー, 自然キー どっち使ったほうがいいか(編集中)

DB

経験者の意見 Composite primary keys versus unique object ID fieldstackoverflow.com

外部参照 PostgreSQL

PostgreSQL 外部参照留め書き 参照する側 が 参照される側 に無い要素を insert, update をすることはできない https://www.postgresql.jp/document/8.1/html/tutorial-fk.html

UIButton の底(bottom) だけ境界線を太くする

やること 甲. UIButton の境界線太さを設定しました 乙. 底(bottom) の境界線だけ更に微調整で太くしたくなりました (立体的な影をつけるイメージ) 乙. を実現する 前提 iOS 8.1 iPad Air (シミュレーター) 登場人物 CustomButtonsViewController(.xib | .h …

UIButton にリサイズした画像を埋め込む

後述の「課題」が残った方法である事、ご承知下さい やること left_arrow.png(130x46 x1) を (50x50 x1) へ等比率画像に変換する 変換画像をボタン(200x200) に埋め込む 前提 iOS 8.1 iPad Air (シミュレーター) 登場人物 CustomButtonsViewController(.xib …

xib のモックレイアウト(ボタン)をコード内部処理で変更する

やること xib で作成したモックのボタンレイアウトを コードで内部処理して 下を例としたボタンレイアウトに変更する 前提 ストーリーボードは使わない iOS 8.1 登場人物 CustomButtonsViewController(.xib | .h | .m) 内部処理 .xib .h #import <UIKit/UIKit.h> @interface</uikit/uikit.h>…

Incompatible pointer types initializing 'UIButton *' with an expression of type 'UIView'

xib に view - viewButton を設置 viewButton へ UIButton を 1 個設置 このボタンのレイアウトをコードで変更するときに from のコードを書くと表題のエラーが出る ので、to にすればよい from UIView *buttonView = self.viewButton.subviews[0] to UIView…

UISplitViewController で 2 つの ViewController を 1 つの画面に表示する

UISplitViewController で 2 つの ViewController を 1 つの画面に表示する 結果イメージ 前提 Storyboad, Segue は使わない Xcode 6.3.1 iOS 8.1 登場人物 LabelsViewController(.xib | .h | .m) (左側に出す画面) ButtonsViewController(.xib | .h | .m) (…

delegate(デリゲート) は 何か, 何ができるのか

delegate(デリゲート) は 何か 他のオブジェクトがイベント通知を受けた時 このオブジェクトの代わりにアクションを実行するオブジェクト an object that acts on behalf of another object when that object encounters an event in a program 何ができるの…

presentViewController を使って値を受け渡す(渡される)

結果イメージ テキストフィールドに @"out me" を入力 Send ボタンを押下する 別画面が開いて @"out me" が表示される 前提 Storyboad, Segue は使わない Xcode 6.3.1 iOS 8.3 登場人物 InputViewController(.xib | .h | .m) (値を受け渡す ViewController) …

Why use NS* instead of char, int, etc...

to simplify creation of instance for many types Class Clustersdeveloper.apple.com

delegate

Draft article what is GoF Delegation The Gang of Four is wrong and you don't understand delegation - Saturn Flyer with Jim Gaywww.saturnflyer.com non-free article Using prototypical objects to implement shared behavior in object-oriented s…

pragma mark

It's just a mark to categorize. No impact on code. reference thanks for your knowledge sharing What is the significance of #pragma marks? Why do we need #pragma marks?stackoverflow.com #pragmanshipster.com

completion at presentViewController ; what is

iOS

The completion block is used for doing any tasks after presenting the view controller reference thanks for your knowledge sharing what should go into completion in presentViewController?stackoverflow.com UIViewController Class Referencedev…

add ViewController to another ViewController

iOS

In this article, let VC as ViewController will output create base VC sub VC add sub VC to base VC create base VC In this article base VC is TopViewController(.h | .m) Main.storyboard Main.storyboard TopViewController.h #import <UIKit/UIKit.h> @interface </uikit/uikit.h>…

InternalInconsistencyException ... nib but the view outlet was not set

iOS

error snippet InternalInconsistencyException nib but the view outlet was not set background Created custom ViewController Combined it to another ViewController Could loaded xib with 'initWithNibName' But above error happened after build fi…

Terminating app due to uncaught exception ‘NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:

iOS

error Snippet Terminating app due to uncaught exception ‘NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: check If you're working on project 'testproject' 1 XYZ.xib exist on Xcode IDE under directory 'testproject' …