CFNumber release : message sent to deallocated instance
[CFNumber release]: message sent to deallocated instance
iphone - "-[CFNumber intValue]: message sent to deallocated instance" and no idea - Stack Overflow
ios - [CFString release]: message sent to deallocated instance - Stack Overflow
iphone - [CFNumber release]: message sent to deallocated instance - Stack Overflow
みたいな感じでStack Overflowに出ておりますが、ARCを利用しているのに、newで始まるメソッド名で参照を返していない場合、タイトルのようなエラーがでるようです。
タイトルに[]が使えないわけですが、どうすりゃいいんでしょう
nkfでUTF-8に変換メモ
UnityのスクリプトファイルをUTF-8(BOM有)に変換するために利用。
$ find . -name "*.cs" -print0 | xargs -0 nkf -w8 --overwrite
too many open filesとか怒られたら処理上限を増やせばいいらしい。
# 現在地表示 $ ulimit -n # 適当に修正 $ ulimit -n 1024
Accessors are only when targeting EcmaScript5 and higher.
TypeScriptをコンパイルしたらエラー。
$ tsc hoge.tsc Accessors are only when targeting EcmaScript5 and higher.
デフォルトがEcmaScript3の設定らしい。ターゲット指定をつける。
$ tsc hoge.tsc --target "ES5"
Mavenでjettyを動かす
pomがあればなんでもできる。ようやくdependencyとpluginの違いがわかってきた感。
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>JettyTest</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>JettyTest</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> <version>9.0.4.v20130625</version> </dependency> </dependencies> <build> <finalName>JettyTest</finalName> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> <debug>true</debug> <optimize>false</optimize> <fork>true</fork> </configuration> </plugin> <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.0.4.v20130625</version> <configuration> <contextPath>/</contextPath> <scanIntervalSeconds>3</scanIntervalSeconds> </configuration> </plugin> </plugins> </build> </project>
コマンド
$ mvn jetty:run
雑感
hotreloadしてくれる、便利。だけど、JNDIでJDBC取得しようとするとMavenで終わらない感じなので諦めた。JNDIで統一してるはずなのにconfigファイルは統一されてないという悲しさ。MavenちゃんがもりもりSSDの容量を食ってる感じが素敵です。
MavenでTomcatで動かしたり理解できるまで
もろもろ自動化できそうだしMaven使ったらいいんじゃねって始めたら、詰まり過ぎで泣いた。
環境
プロジェクトの作成
適当にarchetypeを選んで作成。JavaEE用もある模様。webapp-javaee6/7が良さ気。既存プロジェクトがある場合は素直にEclipseのConvert to Mavenを使うとちょこちょこpom.xmlにも追加してくれたりした。
http://mvnrepository.com/artifact/org.codehaus.mojo.archetypes
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>Kusoneko</artifactId> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <packaging>pom</packaging> <version>1.0-SNAPSHOT</version> <name>Kusoneko</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <!-- servlet用 --> <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> </dependencies> <build> <finalName>Kusoneko</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <server>localhost</server> <url>http://localhost:8080/manager/text</url> </configuration> </plugin> </plugins> </build> </project>
実行
プロジェクト内バンドルみたいな形でtomcat実行。プロジェクトのtargetフォルダ以下にconfフォルダやworkフォルダが作成され実行される。
$ mvn tomcat7:run
サーバで稼働しているtomcatがあれば指定したWebAPI経由でデプロイ操作してくれる。settings.xmlにユーザ情報を書く必要あり。もしくはconfigurationでもいいのかな?
$ mvn tomcat7:deploy
何にはまってたの?
えー、Mavenではデフォルトのソースフォルダの構成が決まってるんですが、ずっと見当違いの場所にservletファイルを作り(resouces以下…)404で悩んでおりました。本当にありがとうございます。archetypeによってはjavaやtestフォルダが作られないので自分で作る必要があります。気をつけましょう、俺。
あれこれ
goalっていまいちわかってないけど実行方法を考えればわかりやすいかな?maven-compiler-pluginでいうならcompile:compile。tomcat7-maven-pluginならtomcat7:runがgoalに当たるという。jettyとかも試したけれど、さくさく確認するならjettyで開発した方がいいきがする。