postgresqlのgem installに失敗
[interfmfun]> gem install pg Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. /home/tgoto/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb checking for pg_config... yes Using config values from /usr/bin/pg_config You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. checking for libpq-fe.h... no Can't find the 'libpq-fe.h header *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir ...
解決策
sudo apt-get install libpq-dev
http://stackoverflow.com/questions/18864112/getting-error-while-installing-postgresql-gem
xmllintインストール
apt-cache search xmllint
sudo apt-get install libxml2-utils
YouTube Data APIをJavaScriptで操作する
ここの「Before your start」を読んで、ビデオを参考にして、oauthの設定をする。
https://developers.google.com/youtube/v3/getting-started
- まず管理画面のデザインが変更になっているのでとまどう。(「APIs & auth」->「Resistered apps」->「Web App-project」でたどり着いた)
- WEB ORIGINにhttpとlocalhostを指定する(例:http://localhost)
- REDIRECT URIにlocalhostを指定するのがミソ(例:http://localhost/oauth2callback)
サンプルを取得する
https://developers.google.com/youtube/v3/code_samples/javascript
githubにあるので、それを取得する
https://github.com/youtube/yt-samples-javascript
git clone https://github.com/youtube/yt-samples-javascript.git
auth.jsの4行目の「OAUTH2_CLIENT_ID」を自分のIDに変更する。
var OAUTH2_CLIENT_ID = '999999999999.apps.googleusercontent.com';
ここからは、環境によるが、とりあえず自分はapacheをインストールした。
sudo apt-get install apache2
サンプルを/var/wwwに移動
ブラウザでアクセス
ログイン認証をするためにsearch.htmlに以下のソースを埋め込む必要がある。
auth.jsで認証に失敗したときに、#login-linkのonclickイベントに再認証する関数を埋め込んでくれる。
<div id="login-container" class="pre-auth">This application requires access to your YouTube account. Please <a href="#" id="login-link">authorize</a> to continue. </div>
frmsというサンプルをrunしたときのエラーの対処法
ここのサイトを参考にしてfinagleのサンプルを動かそうとしたときのエラーの対処法
http://nihito.tumblr.com/post/12784840757/finagle-twitter-restapi-1
sbt runすると以下エラーが。
[warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: com.mongodb.casbah#casbah_2.9.0-1;2.1.5.0: not found [warn] :: org.specs2#specs2_2.9.1;1.6-SNAPSHOT: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: [error] {file:/home/tgoto/finagle/frms/}default-379f5b/*:update: sbt.ResolveException: unresolved dependency: com.mongodb.casbah#casbah_2.9.0-1;2.1.5.0: not found [error] unresolved dependency: org.specs2#specs2_2.9.1;1.6-SNAPSHOT: not found [error] Total time: 89 s, completed 2013/10/27 22:54:38 [frms]>
com.mongodb.casbahと
org.specs2がないということで、
mangodbについては、bilud.sbtのresolversに下2つの行を追加。
resolvers ++= Seq( "twitter-repo" at "http://maven.twttr.com", "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/", "snapshots" at "https://oss.sonatype.org/content/repositories/snapshots", "releases" at "https://oss.sonatype.org/content/groups/scala-tools" )
specs2については、bilud.sbtのlibraryDependenciesのversion指定を以下に変更
"org.specs2" %% "specs2" % "latest.integration" % "test",
latest.integrasionというのが最新版を引っ張ってくれる方法らしい。
それにしてもspecs2って何だろう。
[scala][intellij][sbt] sbt gen-ideaでNot a validが発生
参考
http://mtoyoshi.hateblo.jp/entry/2013/05/12/132456
[project]> sbt gen-idea [info] Set current project to default-9088d5 (in build file:/home/tgoto/tmp/finagle-sample/project/) [error] Not a valid command: gen-idea [error] Expected '/' [error] Expected ':' [error] Not a valid key: gen-idea [error] gen-idea [error] ^ [project]>
project/project配下にplugins.sbtファイルを作成
[project]> cat project/plugins.sbt addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.3.0") [project]>
sbt-ideaのversionは、いろいろいじって1.3.0になりました。
project配下のplugins.sbtとproject/project配下で2個作るのがポイント。
g8のテンプレートからIntelliJの設定を入れる際にsbt-ideaのnot foundエラー
この記事を参考にして、giter8のテンプレートからInterlliJのプロジェクトを作ろうとしたときに、sbt-ideaが見つからないというエラーが出たので、その解決方法を書く。
http://blog.livedoor.jp/tattyamm/archives/4253315.html
エラーの内容
sbt.ResolveException: unresolved dependency: com.github.mpeltonen#sbt-idea;0.11.2: not found at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:214) at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122) at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:121) at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:117) at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:117) at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:105) at sbt.IvySbt.liftedTree1$1(Ivy.scala:52) at sbt.IvySbt.action$1(Ivy.scala:52) at sbt.IvySbt$$anon$3.call(Ivy.scala:61) at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:98) at xsbt.boot.Locks$GlobalLock.withChannelRetries$1(Locks.scala:81) at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102) at xsbt.boot.Using$.withResource(Using.scala:11) at xsbt.boot.Using$.apply(Using.scala:10) at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:62) at xsbt.boot.Locks$GlobalLock.liftedTree1$1(Locks.scala:52) at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:52) at xsbt.boot.Locks$.apply0(Locks.scala:31) at xsbt.boot.Locks$.apply(Locks.scala:28) at sbt.IvySbt.withDefaultLogger(Ivy.scala:61) at sbt.IvySbt.withIvy(Ivy.scala:102) at sbt.IvySbt.withIvy(Ivy.scala:98) at sbt.IvySbt$Module.withModule(Ivy.scala:117) at sbt.IvyActions$.update(IvyActions.scala:121) at sbt.Classpaths$$anonfun$work$1$1.apply(Defaults.scala:955) at sbt.Classpaths$$anonfun$work$1$1.apply(Defaults.scala:953) at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$58.apply(Defaults.scala:976) at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$58.apply(Defaults.scala:974) at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:35) at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:978) at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:973) at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:45) at sbt.Classpaths$.cachedUpdate(Defaults.scala:981) at sbt.Classpaths$$anonfun$47.apply(Defaults.scala:858) at sbt.Classpaths$$anonfun$47.apply(Defaults.scala:855) at sbt.Scoped$$anonfun$hf10$1.apply(Structure.scala:586) at sbt.Scoped$$anonfun$hf10$1.apply(Structure.scala:586) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49) at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311) at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41) at sbt.std.Transform$$anon$5.work(System.scala:71) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18) at sbt.Execute.work(Execute.scala:238) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160) at sbt.CompletionService$$anon$2.call(CompletionService.scala:30) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) [error] (*:update) sbt.ResolveException: unresolved dependency: com.github.mpeltonen#sbt-idea;0.11.2: not found [error] Total time: 3 s, completed 2013/10/27 15:05:52
解決方法
以下の記事を参考にしました。
https://github.com/etorreborre/s99/issues/3
plugins.sbtのsbt-ideaのversionを1.4.0に変更
[project]> cat plugins.sbt resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/" addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.4.0") //sbt-assembly resolvers += Resolver.url("artifactory", url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns) addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.8.4") [project]>