うちのいぬ Tech Blog

Tech Blog of Uchinoinu/My dog

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

Three.js入門 1

のチュートリアルから入門してみました。 codepen.io Scene Sceneは3D空間であり、オブジェクトやカメラ、光源を配置できます。 Sceneの空間のは必要に応じて、拡縮できます。 var scene = new THREE.Scene(); Camera Cameraの設定をするときには以下の4つの…

OSX ElCapitanにPythonでローカルサーバーを立ち上げる

まずはpythonのバージョンを確認 $ python --version Python 2.7.10 Command python2なら $ python -m SimpleHTTPServer [ポート番号(デフォルトは8000)] python3なら $ python3 -m http.server [ポート番号(デフォルトは8000)] 使い方 Rootにしたいディレク…

犬アドベントカレンダー24日目 わんわんスライドショー、いぬんぽGO!

satomi.hatenablog.jp

ベクトルの線形補間について

3D

全然わからないので、まずは言葉の意味から 補間とは wikipedia引用 内挿(ないそう、英: interpolation、補間とも言う)とは、ある既知の数値データ列を基にして、そのデータ列の各区間の範囲内を埋める数値を求めること、またはそのような関数を与えること…

Sending HTTP Request with Custon header like "AccessToken" by Almofire, and Getting them by Rails 4.x

GET with Custom Header by Alamofire let URL = NSURL(string: "https://dinner.please")! let mutableURLRequest = NSMutableURLRequest(URL: URL) let message = "I want to eat!" mutableURLRequest.HTTPMethod = "GET" mutableURLRequest.setValue(mess…

AlamofireでRequest Headerに AccessTokenなどを設定してGETで通信して、Rails4.x でそれらを受け取る

忘れていたので、復習の意味でメモ。 AlamofireでCustom HeadersでGET let URL = NSURL(string: "https://onedari.please")! let mutableURLRequest = NSMutableURLRequest(URL: URL) let message = "tabetai" mutableURLRequest.HTTPMethod = "GET" mutable…

How to use URL including dot (decimal point) in Rails 4.x

What I want to do GET http://domain.jp/api/2.1.1/users or GET http://domain.jp/meats/score/21293.02 (You may say URL with parameter including dot is not good....) How I failed config/routes.rb get 'meats/score/:score' => 'meats#score' rout…

Rails4.x で 少数点(. ドット)を含めたURLを使いたい場合

やりたいこと GET http://domain.jp/api/2.1.1/users とか GET http://domain.jp/meats/score/21293.02 とか、少数点、というかドットが入った形のURLを使う方法についてです。 (そもそもドットの入った値はURLに入れないほうが良いのかもしれませんが...)…

Schemeを共有する

環境 Xcode 7.3.1 Git 2.7.4 MacOS 10.11.5 Github 共有の仕方 ここをタップ 次にここをタップ こんな画面が出るので、sharedのとろこに、共有したいschemeはチェックを入れる そしたらGitで差分がでるので、それをcommitしてpush

Share Schemes

Env Xcode 7.3.1 Git 2.7.4 MacOS 10.11.5 Github How Tap here Next Tap Here You can see screen below, then check-in the checkbox of scheme you want to share Then you can find diff in Git, commit and push it

Back Button of NavBar Tapped when Incrementally Searching using SearchBarNavigationBar, search function cannot act correctly

Environment Xcode 7.3.1 iOS 8+ Situation Implement Incremental Search in TableViewController using SearchBar Input search word Leave by back button of nav bar, not x button or cancel button Search cannot move correctly. Initial View of Sea…

SearchBarでのインクリメンタルサーチ時にNavigationBarのBack Buttonで戻って再度検索をすると正常に動かない件

環境 Xcode 7.3.1 iOS 8+ 状況 SearchBarを使ってTableViewControllerで、インクリメンタルサーチを実装 検索ワードを入力 xボタンやcancelボタンではなく、戻るボタンで離脱 再度検索をしようとしたら、正常に動かなかった 検索画面の初期状況 検索バーにFi…

Calling and configuring UISearchController in viewWillAppear to implement Search View, SearchBar layout became bad

Environment Xcode 7.3.1 iOS 8,9 What's happened? Collapsed layout of SearchBar Search View Input text in SearchBar Search Result Search Target Data can be divided to some layer, so use section and side index list to show them in TableView …

検索機能を実装する際に、UISearchControllerをviewWillAppearで呼んだら、ダメな感じになった

環境 Xcode 7.3.1 iOS 8,9 何が起きたか 検索バーのレイアウトが崩れる 検索画面 検索バーにテキスト入力 検索結果 検索対象のデータが幾つかの階層に分けられるので、sectionで分けたり、サイドにsectionに応じたindexを表示させたりしています。 検索結果…

How to fix error "Could not insert new outlet connection and deleting DerivedData doesnt work"

Environment Xcode 7.3 Situation Using Storyboard, when I tried to connect IBOutlet, error "Could not insert new outlet connection and deleting DerivedData doesnt work" was shown And set automatic in Assistant Editor, No Result was shown, a…

エラー "Could not insert new outlet connection and deleting DerivedData doesnt work" への対処

環境 Xcode 7.3 状況 Storyboardで、該当のコードに対してIBOutletを結ぼうとしたら、"Could not insert new outlet connection and deleting DerivedData doesnt work" というエラーがでた そもそもAssistant Editorでautomaticにしたとき、No Resultとなり…

How to execute some methods at regular intervals like clock

Call NSTimer.scheduledTimerWithTimeInterval( 1, // second target: self, selector: #selector(ThisClass.methodName), userInfo: nil, repeats: true ) Execute func methodName() { print("pikachu!") } In UIViewController override func viewDidLoad…

時計の様に、ある関数を定期的に実行する様な仕組み

呼び出し方 NSTimer.scheduledTimerWithTimeInterval( 1, // 単位は秒で間隔を指定 target: self, selector: #selector(ThisClass.methodName), userInfo: nil, repeats: true ) 実行 func methodName() { print("pikachu!") } UIViewControllerでやるなら o…

Get weekday String from NSDate by Swift

Easy way class func weekdayFromNSDate(date: NSDate) -> String { let cal = NSCalendar.currentCalendar() let comp = cal.components(NSCalendarUnit.Weekday, fromDate: date) let weekdayIndex = comp.weekday let formatter: NSDateFormatter = NSDat…

SwiftでNSDateから曜日を求める方法

割りと楽なやり方 class func weekdayFromNSDate(date: NSDate) -> String { let cal = NSCalendar.currentCalendar() let comp = cal.components(NSCalendarUnit.Weekday, fromDate: date) let weekdayIndex = comp.weekday let formatter: NSDateFormatter…

Morning Study Time Again!

This is 4th morning study time of Swift! Morning Study, which is "Asakatsu" in Japanese, is my favorite style of studying. But these days I had not able to have enough time to it. This time, relaxing and studying is my most important conce…

朝活みたいな感じで、Swiftをもくもく勉強するのを再開してみた!

実は第4回目になります。 朝活は暫く出来ていなかったので、ちゃんと、ゆる〜くやろうと思います。 以前はスタバでやっていてとっても快適だったのですが、今は自宅で。 今回は↓な感じでログを残しながら進めていきます。 ログ ディレクトリ構成は帰るかも …

In Wercker, error "Bundler failing with index file .idx too small error" is show up

Situation Using Wercker for Building and Deploying Rails 4.x application. The Wercker version is Docker. In the build step, Bundler failing with index file .idx too small error error above is occurred so many times. and in the end, Retry e…

Werckerで "Bundler failing with index file .idx too small error" といったエラーが出た場合の対処

状況 普段Rails4系のアプリでWerckerをCIとして使っています。 WerckerはDocker版を使用しています。 そのBuild Stepで Bundler failing with index file .idx too small error といったエラーがたくさんでて、結果的に Retry exceeds max retries といった…

Git command for Deploy or PR merging

Diff of changed files $ git diff --stat commit-new commit-old $ git diff --stat --name-only commit-new commit-old $ git diff --stat --ignore-blank-lines commit-new commit-old Diff of content of file $ git diff commit-old commit-new -- path…

デプロイ前のログや差分をチェックするgitコマンド

変更したfileの抽出 $ git diff --stat commit-new commit-old $ git diff --stat --name-only commit-new commit-old $ git diff --stat --ignore-blank-lines commit-new commit-old fileの変更差分 $ git diff commit-old commit-new -- path/to/file 差…

Links of Restful API(JSON) References

Japanese Here uchinoinu.hatenablog.jp Guideline github.com github.com Platform developer.yahoo.co.jp RESTful Web サービスの基本 Articles qiita.com www.toptal.com 10 Best Practices for Better RESTful API | Thinking Mobile Presentation www.i…

Restful API(JSON)の参考まとめ

Japanese here uchinoinu.hatenablog.jp Guideline github.com github.com Platform developer.yahoo.co.jp RESTful Web サービスの基本 Articles qiita.com www.toptal.com 10 Best Practices for Better RESTful API | Thinking Mobile Presentation www.i…

How to set initial selected tab

Japanese here uchinoinu.hatenablog.jp func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { let tabBar = self.window!.rootViewController as! UITabBarController tabBar.se…

最初に選択されるTabを指定する方法

English here uchinoinu.hatenablog.jp func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { let tabBar = self.window!.rootViewController as! UITabBarController tabBar.sel…