I recently ran into an interesting problem to solve for my side project: how can I efficiently select the top k elements from a very large list in Java / Groovy? There are many recommendations about how to do that, but I didn't find a comparison of the suggested implementations. This is a crucial problem for my application so I tried out a number of them and here are the results. I chose Groovy fo
RE2 is a regular expression engine that runs in time linear in the size of the input. RE2/J is a port of C++ library RE2 to pure Java. Java's standard regular expression package, java.util.regex, and many other widely used regular expression packages such as PCRE, Perl and Python use a backtracking implementation strategy: when a pattern presents two alternatives such as a|b, the engine will try t
入門 Kubeflow ~Kubernetesで機械学習をはじめるために~ (NTT Tech Conference #4 講演資料)
色んなシステムに携わっていると、様々なJavaのクラス名に遭遇する。 ○○Beanとか ○○DTOとか ○○Entityとか ○○VOとか ○○Form。 ここらへんって 「MVCのModelのデータ部分にあたるって意味で同じだし」 とか 「ゲッター/セッターがあるクラスで意味的に一緒じゃない?なんで色々名前つけてんの?」 って思いませんか? ってことで、今回はそれぞれの定義を改めて考えてみようと思う。 とりあえずはそれぞれの意味から ・Bean 総称はBean。あえて言うならJavaBeansの略。 Javaの初心者でも知っている。 あまりに有名すぎるが、Oracleのサイトのガイドを見ながらパクってまとめてみた。 ・Sun Microsystems社のJavaBeans仕様に準拠した再使用可能なソフトウェア・コンポーネント。 ・最低限、クラスにはプロパティが必要。 ・プロパティはメソッ
Builderパターン 個人的にBuilderパターンはオブジェクトの生成制御や、ものによっては可読性が高くて好きなパターンなんですが、その実装には用途によっていくつかパターンがあるので、まとめてみました。 生成するオブジェクトの条件 クラス名:People フィールド:String name(必須), Integer age(必須), String hobby(オプション) 必須要素はnullを禁止 PeopleクラスはStringを返り値とするhelloメソッドを持つ 今回はBuilderパターンの比較のため、パターン上必要でない限りgetterなどのメソッドは省略 Native Builder Builderパターンではなく、ただのコンストラクタ。Builderパターンを使いたくなるのはこれをやりたくないからだけど、比較のために記載。 class People { private S
技術チームインターンの前田です。 アプリケーションを開発していると、データベースと連携する必要が出てくる場合が多いかと思います。 この記事では、JavaプログラムからRDBMSを利用する際に便利なライブラリを紹介します。 このライブラリは、私が取り組んだ業務でも使用したもので、JDBIと呼ばれています。 JDBIとは Javaプログラム↔RDBMS間の連携に便利なSQLライブラリです。 JDBIはJDBCの上に構築されているもので、JDBCのAPIの使い勝手の悪さをカバーしてくれます。 JDBIの便利な点 JDBIを利用することで、簡単にプログラムのロジックとSQL文を分離することが出来ます。 プログラム中のオブジェクトとRDBMSのレコード間の対応付けを行う、所謂O/Rマッパーとしても機能します。 O/Rマッピングの設定に、設定ファイルを使用しません。 似たような機能を持つフレームワーク
SansOrm is not an ORM. SansOrm library will... Massively decrease the boilerplate code you write even if you use pure SQL (and no Java objects) Persist and retrieve simple annotated Java objects, and lists thereof, without you writing SQL Persist and retrieve complex annotated Java objects, and lists thereof, where you provide the SQL SansOrm will never... Perform a JOIN for you Persist a graph of
In software engineering, the initialization-on-demand holder (design pattern) idiom is a lazy-loaded singleton. In all versions of Java, the idiom enables a safe, highly concurrent lazy initialization of static fields with good performance.[1][2] public class Something { private Something() {} private static class LazyHolder { static final Something INSTANCE = new Something(); } public static Some
What is this?This is a Java library you can use in your application to support Unix daemonization. By taking advantages of POSIX API, this library lets you fork your process into background with proper daemonization steps. It currently has several features, which we'll see in more details. DaemonizationOne feature of this library lets you fork a copy into background as a real Unix daemon, when sta
Since we don’t have any nice NMT (Native Memory Tracking) MBean in HotSpot (yet), and therefore not in the JMC console, I thought I’d show how it can be done using command line arguments and JCMD. Please note that you’ll get a 5-10% performance hit if you enable this. Step 1 – Enabling NMT This is done by using the following command line: -XX:NativeMemoryTracking=[off|summary|detail] Where the dif
OSS で Java をやっていく場合,ロジックのテストだけではなく checkstyle や findbugs などによる静的解析を適用して,それを CI で回していかないととてもではないがやっていけない!!! という感じになるので,そこら辺を何とかしたい. 具体的に言うと mvn test でこれらの静的解析をテストと一緒に走らせて,静的解析が1つでも violation を吐き出したら BUILD FAILURE にしたい (もちろんテストがコケても BUILD FAILURE になる). ということで以下のように pom.xml を記述してやります. <build> <plugins> ... <!-- findbugs の設定 --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く