servlet context definition

ServletContext is a configuration Object which is created when web application is started. It contains different initialization parameter that can be configured in web.xml. Difference from ServletConfig ServletConfig is one per servlet whi…

servlet container definition

The basic idea of Servlet container is using Java to dynamically generate the web page on the server side. So servlet container is essentially a part of a web server that interacts with the servlets. quoted from Servlet Container

Servlet definition

A servlet is simply a class which responds to a particular type of network request - most commonly an HTTP request. reference from stackoverflow.com

Strategy Pattern 処理の切替

拠点報告( hubReport.showReport ) を 「東京拠点 → 大阪拠点」と順に出力する 内部処理 処理ロジックを 東京拠点の報告処理 → 大阪拠点の報告処理 としてみる src | +-- jp.ymatsukawa +-- Main.java | +-- report | + -- HubReportStrategy.java (interfac…

インスタンス生成の分岐: Factory method と interface

stuff → staff 素晴らしい 今後この手法を参考にする クライアント側がプロダクション内部のことを気にしなくて良い プロダクション側が固定値でインスタンス生成の分岐可能 引数違いのコンストラクタ生成も可能 src | +-- jp.ymatsukawa +-- Main.java | +-…

インスタンス生成の分岐: Factory method の細工

stuff → staff 続き: インスタンス生成の分岐: factory method パターン - Red > Green > Refactor > Red ダメ 私に響かない クライアント側で冗長な情報が必要 パッケージ名、サブクラス名は公開せねばならぬし (jdbc の悪夢) プロダクション側でインスタン…

インスタンス生成の分岐: factory method パターン

stuff → staff 元: インスタンス生成の分岐(Java) - Red > Green > Refactor > Red 自分に一番響く設計を手当たり次第 デザインパターンの Factory method より (記事中では Factory > Creator) src | +-- jp.ymatsukawa +-- Main.java | +-- stuff | + -- C…

インスタンス生成の分岐(Java)

stuff → staff 思い出し用に書き残し Stfuff のコンストラクタは最適化できるか? まず設計の目的から src | +-- jp.ymatsukawa +-- Main.java | +-- stuff | | | + -- Stuff.java +-- stuffType | + -- StuffType.java + -- Manager.java + -- Engineer.java…

テーブル th, td 幅調整

IE11 th と td は 2 つで 1 つ workspace | |--- index.html |--- main.css index.html <html lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </meta></head></html>

IE で要素を消す visibility: none ではなく display: none

CSS

alternative to visibility:collapse not working on IE and Chromestackoverflow.com

IE

マルチヘッダ (multi th)(1 つの th 内に要素を多数設置して線区切り) の構築

表題通り mac-safari 8.0.7 アウトプットイメージは下 workspace | |--- index.html |--- main.css index.html <html lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </meta></head></html>

div 内の button を centering して left と right に交互へ並べる

mac-safari workspace | |-- index.html |-- main.css index.html <html lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </meta></head></html>

JUnit 4 > org.junit.rules.ExpectedException のアクセス修飾子は public

表題通りそのままです OK @Rule public final ExpectedException exception = ExpectedException.none(); NG @Rule protected final ExpectedException exception = ExpectedException.none(); @Rule private final ExpectedException exception = ExpectedE…

IntelliJ にて Maven プロジェクトを作成し JUnit を dependency する場合の雛形 pom.xml

pom.xml でうまくいかんかったんで source value 1.5 is obsolete 問題(?) なんてのがあるらしく build > plugins > plugin > configuration の source, target を 明示的に利用 JDK の ver (${java.version} ではなく固定値) にしないと 「JDK 1.5 使ってま…

unmodifiable な Map を作成する

こういうの欲しかったので...書き残し 記事 java.util.Collections.unmodifiableMap() Method Examplewww.tutorialspoint.com 引用ソースコードと実行結果 import java.util.*; public class CollectionsDemo { public static void main(String[] s) { //obj…

内部クラス(public) に在るインスタンスメソッドを使う方法

$SOME_DIR/src/Main.java 1 import myutil.ExternalClass; 2 3 public class Main { 4 public static void main(String... args) { 5 ExternalClass externalClass = new ExternalClass(); 6 ExternalClass.SubClass subClass = externalClass.new SubClass(…

for-each の骨組み作っただけで Required Found のコンパイルエラー出た時

ループ変数、ループされる変数 のクラスに食い違いがないか確かめる ———————— 自戒用に書き残し import java.util.List; import org.apache.commons.beanutils.DynaBean; public class Test { public void testMethod(List<DynaBean> resource) { for(List<DynaBean> list : reso</dynabean></dynabean>…

catch 句での Throwable と Exception 違い

Throwable は JVM レベルでの Serious Error を catch する時に使う Exception より高階層な API Exception はアプリケーションレベルでの例外を catch する時に使う Throwable より低階層な API app 構築に当たるならこちらを使うべき Throwable Throwable …

try and re-throw best practice

quoted literal and source code from: IBM Best Practice: Catching and re-throwing Java Exceptions - United States re-throw is ok notice the way to re-throw Correct The correct way to catch and re-throw an exception is to pass the caught exc…

build.sbt の libraryDependencies には何を追加すればよいか

何をどのように追加すればよいか分からなかったので Maven Repository: Search/Browse/Explore に遷移 ヘッダー(?) の検索フォームにライブラリ名を入れる(ここでは postgresql とする) 結果一覧が表示されるので適当なライブラリを選択する(PostgreSQL JDBC…

JDBC Statement と PreparedStatement 使い分け

Statement 単純な実行計画を行いたい時(select * from ... を 1 回だけ など) PreparedStatement 複数回に渡る実行計画を行いたい時, ? のパラメーター解析を使いたい時(2 番目記事参照) JDBC - Statements, PreparedStatement and CallableStatementwww.tut…

connection pool

DB

基本的に、connection は開いたら閉じる 門外不出のOracle現場ワザ 第5章

static method (class method) と instance method の使い分け

Java に関わった話ではないと思い One rule-of-thumb: ask yourself "does it make sense to call this method, even if no Obj has been constructed yet?" If so, it should definitely be static. Java: when to use static methodsstackoverflow.com

static import は控えよ

参考記事 1. に直面したので、書き残し You have an outright naming conflict between java.awt.Event and com.mycompany.calendar.Event, and so you can't even compile. Why is using a wild card with a Java import statement bad?stackoverflow.com

PostgreSQL と Play Framwork を JDBC で連携接続する

環境 MacOSX 10.10.4 JDK 1.8.0_45 Play Framwork 2.4.2(Damiya) 前提 PlayFramework 初期状態から画面構築 に基づいて app 構築している PostgreSQL 構築 (brew だと、createuser 上手くいかんかったんでこっちで... brew はまた別途...) Postgres.app 公式…

sqlite-jdbc を使って Java から sqlite を操作する

ほとんど公式の Usage 通りです... 環境 MacOSX(Yosemite) 10.10.4 Java 1.8.0_45 sqlite3 3.8.5 sqlite DB を準備する $ mkdir ~/Develop $ touch ~/Develop/development.sqlite3 sqlite-jdbc を準備する ダウンロードページから適当な jar を取ってくる(最…

Play framework(Java) で initialize, routing, view 作成, controller 作成して画面表示まで

大前提 MacOSX(Yosemite) 10.10.4 Java 1.8.0_45 Play Framework 2.4.2 "Damiya" activator-1.3.5-minimal 公式サイトの [Download "Damiya"]を直接押下 initialize $ cd activator-1.3.5-minimal/ $ ./activator new Browse the list of templates: http://…

String と StringBuilder の使い分け

メモリ利用量 パフォーマンス が気になる時に切り分け 延々mallocとかもう... http://stackoverflow.com/a/4645155

Postfix 550 5.1.1 Recipient address rejected

Postfix error > 550 5.1.1 Recipient address rejected にて...気になった記事を留め書き Server refuses mail with 550 5.1.1 : Recipient address rejected: User unknown ...www.linuxquestions.org