Posts

Java Clojure Interoperability, Calling Clojure from Java

So far, Java interoperability with Clojure is pretty seamless. Calling Java from Clojure is pretty much built into the language. Calling Clojure from Java is easy as well. I didn't do any research before coming up with this example, I essentially looked at the Clojure Java source code and went from that. Here is an example, invoking Clojure and then passing a Spring Framework Context object to the Clojure code, also calling Clojure methods. There is the advantage in doing this, you can write concise Clojure code and then invoke that module from Java. package test.toolkit. clojure ; import org . springframework . context . support . ClassPathXmlApplicationContext ; import clojure . lang . Namespace ; import clojure . lang . RT ; import clojure . lang . Symbol ; import clojure . lang . Var ; public class TestSpringLoadClojure { /////////////////////////////////////////////////////////////////////////// public static void loadScripts () throws Exc...

XHtmlrenderer, for XHTML to PDF, PNG, JPEG, etc new release candidate 8

Image
https://xhtmlrenderer.dev.java.net/news.html BEGIN QUOTE We once again thank the many people who contributed to this release (named in the changes that follow). * Features o Upgrade to use iText 2.0.8 o Support for callback on form submission using new FormSubmissionListener interface; patch from Christophe Marchand (thanks, Christophe!). o Support reading properties which are not in our standard config file, passed in via an override config file or via System properties. This is to support extended configuration parameters for JDK logging, e.g. appenders, formatters, etc. o Added XML-APIs to lib directory to support compilation when using Java 1.4, which includes it's own (old) version of the XML APIs. This allows us to reference classes in the newer XML APIs for which there are Java 1.4 implementations. o Support adding custom header properties on PDF output o Add ability to set PDF version programmatically ...

Lisp in Java (Kanji Version)

Image
単純なJavaで実装舌足らず(オーデのリンクリストへ) 概要 私は自然言語()を記述するために多くの親和性がありませんが、私が成長してきたとプログラミングを楽しみ、その20年後に何かを続けている。しかし、私は本当にこのブログのエントリを得るために、私を見直すとreframeどうすればコードの特定の部分を見ている。だから私は違う方向、 1台のコンピュータサイエンスは、リンクされたリストの中で最も基本的なデータ構造の開始で移動するつもりです。舌足らずのコードの代わりにする(とにかく思考)としての要素の"リスト" 。舌足らずのコードの要素のリンクリストとして考えています。 *どのようにしてC言語では、リンクのリスト(またはJavaやフォートラン)を実装するのですか? *どのようにして、すべてのリンクリストの要素を印刷するのでしょうか? *どのようにしてすべての要素の和でしょうか? 最後の数字の操作をした後のことを考えですか?さまざまなリストの操作を実装することが可能な方法を考えることができます、舌足らず操作'のようなマップ' ? のリンク一覧 なぜリンクされている舌足らず一覧することが重要ですか? "舌足らず名一覧言語" 。リンクリストの処理"から派生1舌足らずの言語の主要なデータ構造体の"です は、 Java /のC / C + +や他の手続き型言語プログラムでは、リンクされたリストは通常2つのフィールドは、データ自体は(任意のオブジェクトの型の)と"ポインタ"または、次の要素にリンクされているリストを参照する構成で構成されています。以下のJavaコードの断片では、データの要素に、リスト内の現在のノードを指す。ノードオブジェクトの"次へ"をリストチェーン内の次のノードへの参照です。 ... ... 結論 これはJavaでは、 Scheme /舌足らず実装連結リストのデータ構造からのスタートと通訳コードに続けて自分の実行を終えます。そのNorvigの実装に追加されることがたくさんある。 R5RS制度を実施を完全にサポートを追加します。改善の入力/出力のサポートを追加します。アークからのコピー、または共通舌足らず興味深い機能してい...

Converting some blogs to Spanish and Japanese and the Light Text Editor

Image
I am converting some of my blog to spanish and japanese. Yo estoy converso este blog a Espanol and Japonese. Gracias. Primero, yo puedo dígale esta uso. Light editor de textos. Light escrito adentro Clojure, SWT and Java. http://code.google.com/p/lighttexteditor/ -------- Corrected, I am still learning. "Estoy convertiendo algunos de mi blog al español y japonés." --------

Doing it wrong, fun with Clojure

Image
I certainly take a liberal approach to programming, some may call it quantity over quality but I like to enjoy everything I do. This may include doing it wrong, but sometimes I like the end result. I am working on a SWT GUI tool and could not figure out a clean way to avoid SWT's illegal thread exceptions. When a user clicked a menu option on the gui, I needed to first take text from an edit box field and then use that data to pass to a long running thread. This is what I ended up with: ;; Define the clojure 'agent', save the state of our search box ( def *search-text-state* (agent nil)) ;; Define an implementation of 'SelectionAdapter/Interface' ;; SelectionAdapter requires one method 'widgetSelected' ;; With display.syncExec, pass an implementation of java.lang.Runnable ;; The thread updates the 'agent' search-text-state text. ;; After we get this text value, then launch another thread 'start-findgrep' ( def findgrep-listener (p...

Test Driven Development, BDD and Junit

Here is a question I asked on stackoverflow. The responses are pretty interesting. I don't know if you read the recent post by Joel, but basically he says that you don't need unit testing for every unit or piece of code in your code base. "And that strikes me as being just a little bit too doctrinaire about something that you may not need. Like, the whole idea of agile programming is not to do things before you need them, but to page-fault them in as needed." -- Joel And I would say that most developers don't have full coverage anyway, yet there are some blogs out there touting the 100% code coverage. "Yeah. In fact, if you're making any kind of API, a plug in API, it is very important to separate things into interfaces and be very very contractual, and tightly engineered" -- Joel "Right. The longer I think about this, the less I care about code hygiene issues (laughs). Because the unit of measure that really matters to me is, how quickly you ...

Cher is a moron, or why I hate group-think hate on other groups

Image
http://cnsnews.com/public/content/article.aspx?RsrcID=43192 Cher is a moron. "You know what? I have so – I try to be charitable and there are some really good Republicans, but I just don’t understand how anyone would want to be a Republican. I just can't figure it. I don’t understand," she said. 'If you’re poor, if you're any kind of minority – gay, black, Latino, anything. If you’re not a rich – I don’t know. If you're not a rich born-again-Christian, I don't get it." I have a comment for you, musicians shouldn't discuss politics. How does that feel? Doesn't make a lot of sense, does it? I feel that there isn't such thing as a "Republican", the same way that I feel there is no such thing as a "black" person or a "white" person. Race is also unscientific and difficult to categorize people. You have genealogy which can be traced from generation to generation, but that doesn't mean anything. For example, ...