Angel \”Java\” Lopez on Blog

March 26, 2013

Scala: Links, News And Resources (3)

Filed under: Functional Programming, Java, JVM, Links, Programming Languages, Scala — ajlopez @ 3:46 pm

Previous Post

Scalaz
http://code.google.com/p/scalaz/
https://github.com/scalaz/scalaz
Scalaz: Type Classes and Pure Functional Data Structures for Scala
 
CLOJURE VS SCALA
http://hammerprinciple.com/therighttool/items/clojure/scala
Suppose you had to choose between Clojure and Scala, which would you pick?
 
ScalaIDE for Eclipse
http://scala-ide.org/

Scala for the Intrigued: Creating Higher Order Functions
http://pragprog.com/magazines/2012-02/scala-for-the-intrigued
 
Scala for the Intrigued: Working with Collections
http://pragprog.com/magazines/2012-01/scala-for-the-intrigued
n this fifth installment of his series on the Scala programming language, Venkat mixes object oriented and functional styles to reveal the power and grace of Scala collections.
 
Scala for the Intrigued: Cute Classes and Pure OO
http://pragprog.com/magazines/2011-11/scala-for-the-intrigued
This third installment of his series on Scala shows how Scala’s OO purity leads to simple, elegant code.
 
Scala for the Intrigued: Functional Style of Programming
http://pragprog.com/magazines/2011-12/scala-for-the-intrigued
Venkat delves into the functional style of programming in Scala.
 
Languages, Verbosity, and Java
http://www.informit.com/articles/article.aspx?p=1824790
With the new spate of programming languages emerging for the Java virtual machine and other platforms, it’s more important than ever that the rules of a language make code clear and concise. But clarity and conciseness don’t exactly go hand in hand.
 
Running Spring Java and Scala Apps on Heroku
http://www.infoq.com/presentations/Running-Spring-Java-and-Scala-Apps-on-Heroku
 
A little scalaz IO action
https://gist.github.com/1552195

Functional IO in Scala with Scalaz
http://www.stackmob.com/2011/12/scalaz-post-part-2/
 
Everything I Ever Learned about JVM Performance Tuning @twitter
http://www.infoq.com/presentations/JVM-Performance-Tuning-twitter
Attila Szegedi discusses performance problems encountered at Twitter running Java and Scala applications, presenting how they solve them through JVM tuning.
 
Offbeat: Scala by the end of 2011 – No Drama but Frustration is Growing
http://gridgaintech.wordpress.com/2011/12/11/offbeat-scala-by-the-end-of-2011-no-drama-but-frustration-is-growing/
 
Real life Scala feedback from Yammer
http://blog.joda.org/2011/11/real-life-scala-feedback-from-yammer.html

Actors: can we do better?
http://vimeo.com/20307408
Paul Chiusano presents to the Northeast Scala Symposium nescala.org

scala symposium Boston
http://nescala.org/
 
Continuations and Other Functional Patterns
http://vimeo.com/20305325

Building an HTTP streaming API with Scala
http://vimeo.com/20306881
 
Guerrilla Guide to Pure Functional Programming
http://vimeo.com/20293743

Referentially transparent nondeterminism
http://pchiusano.blogspot.com/2011/06/referentially-transparent.html
 
Scala’s version fragility make the Enterprise argument near impossible
http://lift.la/scalas-version-fragility-make-the-enterprise
An attribute of Scala is that the Scala compiler generates fragile byte-code.  This means that all the code in an executable (JAR or WAR) must be compiled with the same library and compiler versions.

Functional Scala: Curried Functions and spicy Methods
http://gleichmann.wordpress.com/2011/12/04/functional-scala-curried-functions-and-spicy-methods/
 
Functional Programming For Java Programmer Scala Or Clojure?
http://www.nairaland.com/nigeria/topic-718309.0.html

Scala vs Ceylon vs Kotlin
https://plus.google.com/105933370793992913359/posts/4ihU1TdzSA8

Scala feels like EJB 2, and other thoughts
http://blog.joda.org/2011/11/scala-feels-like-ejb-2-and-other.html
 
My Links
http://delicious.com/ajlopez/scala

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

March 14, 2013

Scala: Links, News And Resources (2)

Filed under: Functional Programming, Java, JVM, Links, Programming Languages, Scala — ajlopez @ 3:52 pm

Previous Post
Next Post

More about Scala programming language and ecosystem

Learning Scala? Learn the Fundamentals First
http://tataryn.net/2011/10/learning-scala-learn-the-fundamentals-first/

Injectors and Extractors in Scala
http://blog.jayway.com/2011/10/11/injectors-and-extractors-in-scala/

How to maintain compatibility and language quality
https://gist.github.com/1241465

Akka 2.x roadmap…
https://docs.google.com/document/pub?id=1CMz_MEQA8oPcGw9oaFdq_KYYFB_5qZjsDYYwuXfZhBU&pli=1

Look ma…. location transparency

London Scala Users’ Group:Practical Scalaz: making your life easier the hard way
http://skillsmatter.com/podcast/home/practical-scalaz-2518/js-2679

jdegoes / blueeyes
https://github.com/jdegoes/blueeyes
A lightweight Web 3.0 framework for Scala, featuring a purely asynchronous architecture, extremely high-performance, massive scalability, high usability, and a functional, composable design.

Actors that Unify Threads and Events
http://lamp.epfl.ch/~phaller/doc/haller07actorsunify.pdf

Clojure vs Scala – anecdote Options
http://groups.google.com/group/clojure/browse_thread/thread/b18f9006c068f0a0?pli=1

Contrasting Performance : Languages, styles and VMs – Java, Scala, Python, Erlang, Clojure, Ruby, Groovy, Javascript
http://blog.dhananjaynene.com/2011/08/cperformance-comparison-languages-styles-and-vms-java-scala-python-erlang-clojure-ruby-groovy-javascript/

Scala: Making it easier to abstract code
http://www.markhneedham.com/blog/2011/07/23/scala-making-it-easier-to-abstract-code/

Scala: Companion Objects
http://www.markhneedham.com/blog/2011/07/23/scala-companion-objects/

Scala programming tutorial part 1. (environment setup)
http://www.youtube.com/watch?v=zicyW1EeRIU

Scala programming tutorial part 2. (executable, print)
http://www.youtube.com/watch?v=9mFV9pfUenU

Working Hard to Keep It Simple in Scala
http://www.softdevtube.com/2011/08/01/working-hard-to-keep-it-simple-in-scala/

Good article on Functional Programming #FunctionalProgramming #Scala #ErLang
http://vikasgoel.tumblr.com/post/8369381751/good-article-on-functional-programming

Working Hard to Keep It Simple
http://www.oscon.com/oscon2011/public/schedule/detail/21055

My Links
http://delicious.com/ajlopez/scala

More Scala resources are coming

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

May 15, 2012

Metaprogramming: Links, news and resources (1)

Filed under: Java, JVM, Links, Metaprogramming, Programming Languages, Ruby, Smalltalk — ajlopez @ 1:33 pm

As a programming language fan and writer of many interpreters, I’m interested in metaprogramming. Some links I found useful:

http://en.wikipedia.org/wiki/Metaprogramming

Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In some cases, this allows programmers to minimize the number of lines of code to express a solution (hence reducing development time), or it gives programs greater flexibility to efficiently handle new situations without recompilation.

magarciaEPFL / MethodHandleUtils
https://github.com/magarciaEPFL/MethodHandleUtils
JVM: Composing MethodHandles at runtime like AST nodes
Runtime metaprogramming via java.lang.invoke.MethodHandle
http://lampwww.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/2012Q2/RuntimeMP.pdf

Ruby Metaprogramming: Declaratively Adding Methods to a Class
http://www.vitarara.org/cms/ruby_metaprogamming_declaratively_adding_methods_to_a_class

dlitvakb / MetaBuilder
https://github.com/dlitvakb/MetaBuilder
A Ruby MetaProgramming Excercise

Adding Properties to Ruby Metaprogramatically
http://www.infoq.com/articles/properties-metaprogramming

Ruby: More About Methods
http://ruby-doc.org/docs/ProgrammingRuby/html/tut_methods.html

Calling Methods Dynamically
http://www.linuxtopia.org/online_books/programming_books/ruby_tutorial/Reflection_ObjectSpace_and_Distributed__Ruby_Calling_Methods_Dynamically.html

Ruby dynamic method calling
http://khelll.com/blog/ruby/ruby-dynamic-method-calling/

celluloid / celluloid
Actor-based concurrent object framework for Ruby

MetaProgramming – Extending Ruby for Fun and Profit
http://www.infoq.com/presentations/metaprogramming-ruby

Three implicit contexts in Ruby
http://yugui.jp/articles/846
Yehuda Katz wrote an article about self and metaclass. In the article he said that Person.instance_eval assigns Person’s metaclass to self for a class Person. But this is obviously wrong.
Ruby always has three implicit contexts: self), so called `klass’ and the constant definition point.

Metaprogramming in Ruby: It’s All About the Self
http://yehudakatz.com/2009/11/15/metaprogramming-in-ruby-its-all-about-the-self/

class << self idiom in Ruby
http://stackoverflow.com/questions/2505067/class-self-idiom-in-ruby

ClassInstanceVariable
http://martinfowler.com/bliki/ClassInstanceVariable.html

Default Ruby accessor method?
http://stackoverflow.com/questions/636277/default-ruby-accessor-method
method_missing; it gets called whenever an undefined method is used

A Logic Meta-Programming Approach
to Support the Co-Evolution of
Object-Oriented Design and Implementation
http://scg.unibe.ch/archive/phd/Wuyts-phd.pdf

Meta-level Programming with CodA
http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.108.6885

C#5 and Meta-Programming
http://codebetter.com/patricksmacchia/2010/05/31/c-5-and-meta-programming/

Metaprogramming in .NET
http://www.manning.com/hazzard/

Whole Platform
http://whole.sourceforge.net/
the Whole Platform provides an Eclipse-based Language Workbench for developing new languages, manipulating them using domain notations and transforming them using a generative model driven approach.

Code Generation on the JVM: Writing Code that Writes Code
http://www.infoq.com/presentations/Code-Generation-on-the-JVM

Rascal – Meta Programming Language
http://www.rascal-mpl.org/
Rascal is a domain specific language for source code analysis and manipulation a.k.a. meta-programming.

Write A Template Compiler For Erlang
http://evanmiller.org/write-a-template-compiler-for-erlang.html
Implementing the Django Template Language in Erlang

Groovy: Best Practices Developed From Distributed Polyglot Programming
http://www.infoq.com/presentations/Groovy-Best-Practices

The Magnificent Seven
http://fogus.me/static/preso/magnificent7/#slide1
creating a Lisp variant in seven forms

The calculator language tutorial
http://www.jetbrains.com/mps/docs/tutorial.html

The art of metaprogramming, Part 1: Introduction to metaprogramming
http://www.ibm.com/developerworks/linux/library/l-metaprog1/index.html
One of the most under-used programming techniques is writing programs that generate programs or program parts. Learn why metaprogramming is necessary and look at some of the components of metaprogramming (textual macro languages, specialized code generators). See how to build a code generator and get a closer look at language-sensitive macro programming in Scheme.

Through the Looking Glass Darkly
http://gbracha.blogspot.com.ar/2010/03/through-looking-glass-darkly.html
The classic approach to reflection in object-oriented programming languages originates with Smalltalk, and is used in most class based languages that support reflection: define a reflective API on Objec
nother approach is used in many scripting languages. The language constructs themselves introduce code on the fly, modifying the program as they are executed.
The third approach is that of mirrors, and originates in Self. Mirrors have been used in class based systems such as Strongtalk, and even in the Java world. JDI, the Java Debugger Interface, is a mirror based reflective API. Here, the reflective operations are separated into distinct objects called mirrors.

Mirrors: Design Principles for Meta-level Facilities of Object-Oriented Programming Languages
http://www.bracha.org/mirrors.pdf

Metaprogramming: Ruby vs. Javascript
http://fingernailsinoatmeal.com/post/292301859/metaprogramming-ruby-vs-javascript

Metaprogramming in Ruby
http://ruby-metaprogramming.rubylearning.com/

A Basic YAML Config Module For Ruby
http://lostechies.com/derickbailey/2009/10/05/a-basic-yaml-config-module-for-ruby/

Categories, the homemade object system
http://lambda-the-ultimate.org/node/3569

Categories
http://mikelevins.livejournal.com/3678.html

Why? Language Archaeology … and Metaprogramming
http://www.artima.com/weblogs/viewpost.jsp?thread=260578

Metaclasses Demystified
http://cleverdevil.org/computing/78/
The word “metaclass” often strikes fear into the hearts of Python programmers. This article explores metaclasses in an approachable way, in order to take the mystery out of metaclasses, and enable you to leverage metaprogramming techniques to solve real problems.

Dupping Our Way Out of Instance Eval
http://banisterfiend.wordpress.com/2008/12/19/dupping-our-way-out-of-instance-eval/

Ruby.rewrite(Ruby)
http://www.infoq.com/presentations/braithwaite-rewrite-ruby
In this RubyFringe talk, Reginald Braithwaite shows how to write Ruby that reads, writes, and rewrites Ruby. The demos include extending the Ruby language with conditional expressions, new forms of evaluation such as call-by-name and call-by-need, and more.

Smalltalk magritte-metamodel
http://code.google.com/p/magritte-metamodel/
Magritte is a fully dynamic meta-description framework that helps to solve those problems, while keeping the full power to the programmer in all aspects.

My Links
http://delicious.com/ajlopez/metaprogramming

More links about DLSs, programming languages, and metaprogramming are coming.

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

March 21, 2012

Clojure: Links, News And Resources (5)

Filed under: Clojure, Java, Links, Lisp, Programming Languages — ajlopez @ 8:31 pm

Previous Post
Next Post

Clojure/core — (take 5 william-byrd)
http://clojure.com/blog/2012/02/16/take5-william-byrd.html
William Byrd is a postdoc at Indiana University researching the applicability of declarative programming techniques to high-performance computing domains. In addition, he is one of the three authors of the fantastic book The Reasoned Schemer that walks the reader through the development of a small …

pallet/zi – GitHub
https://github.com/pallet/zi
Zi is a maven plugin for clojure.

mmikulicic / clarsec
https://github.com/mmikulicic/clarsec
Parsec monadic parser ported to clojure

youngnh / parsatron
https://github.com/youngnh/parsatron
Clojure parser combinators

Clojure vs Scala · Compare programming languages · Programming Languages
http://hammerprinciple.com/therighttool/items/clojure/scala
The absolute rankings are interesting for large scale comparisons but when you want to know about two specific languages it’s much more informative to look at how the two fare when they go directly head to head.

Reflections on a real-world Clojure application (take 2)
http://blog.malcolmsparks.com/?p=56
Last night I gave a talk at the London Clojure Users Group (LCUG) about a ‘real-world’ (16K lines-of-code) application we built in less than a year with Clojure at Deutsche Bank.

Doing Things ←
http://www.clojure.net/2012/02/08/Doing-things/
So far, we’ve looked at the sequence monad and the set monad. Hopefully by now you’ve gotten a feel for how m-result and m-bind work for those two examples.

Clojure demo web application using Ring, Compojure, MongoDB and Fusion Charts.
http://www.youtube.com/watch?v=4CFy5C2OvM4&feature=youtu.be
A demo web application using Clojure, Ring, Compojure, MongoDB, Fusion Charts.

The RedMonk Programming Language Rankings: February 2012 – tecosystems
http://redmonk.com/sogrady/2012/02/08/language-rankings-2-2012/
For years now, it has been self-evident to us at RedMonk that programming language usage and adoption has been fragmenting at an accelerating rate

Using dynamic programming to calculate Stirling numbers
http://biesnecker.com/dynamic-programming-stirling-number-calculator.html

IT Software Community – John W. Verity – LISP Is Back, and It’s Baaaaad!
http://www.itsoftwarecommunity.com/author.asp?doc_id=238067&section_id=1624

gelfino
http://documentup.com/narkisr/gelfino/
Gelfino is a tiny embeddable Gelf server written in pure Clojure, Gelfino enables real time processing of log events through streams.

(david-mcneil.com:blog), Clojure Robot DSL
http://david-mcneil.com/post/17044248397/clojure-robot-dsl

Sets Not Lists ←
http://www.clojure.net/2012/02/04/Sets-not-lists/

Functional Relational Programming with Cascalog
http://clojure.com/blog/2012/02/03/functional-relational-programming-with-cascalog.html

Stuart Sierra: “Learning Clojure – Next Steps” | Clojure on Blip
http://blip.tv/clojure/stuart-sierra-learning-clojure-next-steps-5921905
You can conj and assoc like a pro. You eat macros for breakfast.What’s next?

The Pragmatic Bookshelf | PragPub 2011-08 | Hello, ClojureScript!
http://pragprog.com/magazines/2011-08/hello-clojurescript
Clojure rocks, JavaScript reaches. ClojureScript is the realized inevitability of Clojure’s expansion to other platforms.It seems these days you can’t write a web-based application without reaching for JavaScript.

David McNeil: “Concurrent Stream Processing” | Clojure on Blip
http://blip.tv/clojure/david-mcneil-concurrent-stream-processing-5919702
The foundation of our query processing engine is a concurrent data stream processor. This processor is characterized by the need to efficiently perform parallel, non-blocking processing of multiple data streams which are too large to fit in memory.

InfoQ: One () to Rule them All
http://www.infoq.com/presentations/One-Parenthesis-to-Rule-them-All
Aaron Bedra introduces Clojure and details how ClojureScript – a Clojure subset compiled to JavaScript – helps with web development.

Clojure/core — First Conj 2011 Videos Available
http://clojure.com/blog/2012/01/31/first-conj-2011-videos-available.html
Five videos from Clojure Conj 2011 are now available.

Home // Overtone
http://overtone.github.com/
Overtone is an open source audio environment being created to explore musical ideas from synthesis and sampling to instrument building, live-coding and collaborative jamming. We use the SuperCollider synth server as the audio engine, with Clojure being used to develop the APIs and the application. …

On Beyond Lambda: Clojure is one answer
http://onbeyondlambda.blogspot.com/2012/01/my-last-post-was-link-to-video-t...
A travel log of a .NET developer as he explores Clojure and F#, and looks for ways to apply C# to a multi-core world.A travel log of a .NET developer as he explores Clojure and F#, and looks for ways to apply C# to a multi-core world.

richard-lyman/amotoen – GitHub
https://github.com/richard-lyman/amotoen
Amotoen is a Clojure library that supports PEG style definitions of grammars that can produce parsers

Clojure for Ruby Programmers – Stuart Halloway – Ruby Conference 2009
http://confreaks.com/videos/191-rubyconf2009-clojure-for-ruby-programmers

My Links
http://delicious.com/ajlopez/clojure

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

February 22, 2012

Clojure: Links, News And Resources (4)

Filed under: Clojure, Java, Links, Lisp, Programming Languages — ajlopez @ 4:02 pm

Previous Post
Next Post

More links about Clojure programming languages:

Event-Driven Programming in Clojure
http://www.infoq.com/presentations/Event-Driven-Programming-in-Clojure

Beginning with Clojure
http://clojurelx.blogspot.com/2012/01/beginning-with-clojure.html

The Making of Typkov
http://www.youtube.com/watch?v=uTwnoZEw7FE&feature=youtu.be
Build a little webapp in Clojure/Noir from scratch

Clojure GUI Demo of Planetary Orbitals
http://juliangamble.com/blog/2012/01/23/clojure-gui-demo-of-planetary-orbitals/

Metaweblog API
https://github.com/brehaut/necessary-evil/wiki/Metaweblog-API

Backlog: Ola Bini on Clojure/conj
http://www.leonardoborges.com/writings/2012/01/22/backlog-ola-bini-on-clojure-conj/

Why Jark
http://icylisper.in/jark/
Startup time of the Java Virtual Machine(JVM) is quite slow and thereby command-line applications on the JVM are sluggish and very painful to use. Jark is an attempt to run a persistent JVM daemon and provide a set of utilities to interact with it.

All Your HBase Are Belong to Clojure
http://twitch.nervestaple.com/2012/01/12/clojure-hbase/

Introducing ClojureScript One
http://clojure.com/blog/2012/01/11/announcing-clojurescript-one.html
Here at Relevance, we spent some time recently looking at the ClojureScript experience. We were specifically concerned with finding the pain points in ClojureScript development. To make the experience as real as possible, we chose to rewrite a client application which had been written in CoffeeScript.

ClojureScript One
http://clojurescriptone.com/
ClojureScript One shows you how to use ClojureScript to build single-page, single-language applications in a productive, effective and fun way.

Object-oriented Clojure
http://css.dzone.com/articles/object-oriented-clojure

Web application in Clojure: the starting poin
http://css.dzone.com/articles/web-application-clojure

Some Thoughts on Classes After 18 Months of Clojure
http://vimeo.com/34522837

Create a basic web application in clojure
http://www.agilogy.com/blog/create-a-basic-web-application-in-clojure.html

fogus / fojure
https://github.com/fogus/fojure
a dumb little fp language written in Clojure

Immutant
http://immutant.org/
Immutant is an application server for Clojure built on top of JBoss AS7. It is a new project, but we already support Ring handlers and asynchronous messaging, and we are working on additional features.

My Clojure Adventure
http://www.myclojureadventure.com/

ClojureCLR
http://clojureclr.blogspot.com/

Getting Started with Clojure-clr
http://www.myclojureadventure.com/2011/10/getting-started-with-clojure-clr.html

roman / clj-stream
https://github.com/roman/clj-stream
Oleg’s Iteratees in Clojure

Road-map – or n+1 steps to enlightenment (or loonybind)
http://clojurelx.blogspot.com/2011/11/road-map-or-n1-steps-to-enlightenment.html

geoffsalmon / bytebuffer
https://github.com/geoffsalmon/bytebuffer
Clojure lib for packing and unpacking binary data using a java.util.ByteBuffer

Survey says: viability is number one
http://clojureclr.blogspot.com/2011/11/survey-says-viability-is-number-one.html

ClojureCLR has a new home
http://clojureclr.blogspot.com/2011/11/clojureclr-has-new-home.html

Clojure
http://groups.google.com/group/clojure/msg/d52aff66b951b460?pli=1

What is a multimethod?
http://krisjordan.com/multimethod-js

4Clojure
http://www.4clojure.com/
4Clojure is a resource to help fledgling clojurians learn the language through interactive problems. The first few problems are easy enough that even someone with no prior experience should find the learning curve forgiving.

Testing Storm Topologies (in Clojure)
http://www.pixelmachine.org/2011/12/17/Testing-Storm-Topologies.html

Maven Settings and Repositories
http://dev.clojure.org/display/doc/Maven+Settings+and+Repositories

dmansen / boggle
https://github.com/dmansen/boggle
A boggle solver, in clojure

Fractals in Clojure – Distributed Buddhabrot Fractal Using ClojureScript
http://nakkaya.com/2011/12/15/fractals-in-clojure-distributed-buddhabrot-fractal-using-clojurescript/

marick / Midje
https://github.com/marick/Midje
Midje provides a migration path from clojure.test to a more flexible, readable, abstract, and gracious style of testing

The Barbarians are at the Gates
http://blog.8thlight.com/uncle-bob/2011/12/11/The-Barbarians-are-at-the-Gates.html
By @unclebob

(take 6 carin-meier)
http://clojure.com/blog/2011/12/12/take6-carin-meier.html
Carin Meier is a veteran of the Clojure Conj scene having attended both installments and a true asset to both the Ruby and Clojure communities.

Tips for using marginalia
http://www.lispcast.com/tips-for-marginalia

Converting Command Line String Integers To Integers
http://drknucklehead.wordpress.com/2011/12/08/converting-command-line-string-integers-to-integers/

bitsai / clojure-actors
https://github.com/bitsai/clojure-actors
Actors implemented on top of Clojure agents

Erlang style actors implemented using clojure agents
https://github.com/bertschi/clojure-stuff/blob/master/src/stuff/actors.clj

stathissideris / clarity
https://github.com/stathissideris/clarity
A wrapper for Swing aiming to provide more concise syntax and extra functionality. Still in heavy development, syntax may change radically.

Introducing Clarity: Swing application development for Clojure
http://skillsmatter.com/podcast/scala/lightening-talk-clarity-a-wrapper-for-swing

A Refreshed View on Community : Clojure Conj 2011
http://www.uiandtherest.com/ui/index.php/2011/11/11/a-refreshed-view-on-community-clojure-conj-2011/

Clojure: STMs vs Locks
http://www.azulsystems.com/blog/cliff/2008-05-27-clojure-stms-vs-locks

Clojure for dummies: a kata
http://java.dzone.com/articles/clojure-dummies-kata-0

Introducing Avout: Distributed State in Clojure
http://clojure.com/blog/2011/11/29/avout.html

The Clojure Community and Me
http://blog.raynes.me/blog/2011/11/27/the-clojure-community-and-me/

Clojure’s protocols influences?
http://stackoverflow.com/questions/3682011/clojures-protocols-influences

Evangelizing Clojure
http://rhebus.posterous.com/79870335

My Links
http://delicious.com/ajlopez/clojure

More links about Clojure, Lisp, Functional Programming and Languages are coming.

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

February 19, 2012

Scala: Links, News and Resources (1)

Filed under: .NET, Functional Programming, Java, Links, Programming Languages, Scala — ajlopez @ 7:43 pm

Next Post

These are my first Scala programming language links.

http://en.wikipedia.org/wiki/Scala_%28programming_language%29

Scala (play /ˈskɑːlə/ skah-lə) is a multi-paradigm programming language designed to integrate features of object-oriented programming and functional programming.[3] The name Scala is aportmanteau of “scalable” and “language”, signifying that it is designed to grow with the demands of its users. James Strachan, the creator of Groovy, described Scala as a possible successor to Java.[4]

The design of Scala started in 2001 at the École Polytechnique Fédérale de Lausanne (EPFL) by Martin Odersky, following on from work on Funnel, a programming language combining ideas from functional programming and Petri nets.[5][not in citation given] Odersky had previously worked on Generic Java and javac, Sun’s Java compiler.[5]

Scala was released late 2003 / early 2004 on the Java platform, and on the .NET platform in June 2004.[3][5][6] A second version of the language, v2.0, was released in March 2006.[3]

On 17 January 2011 the Scala team won a 5 year research grant of over €2.3 million from the European Research Council.[7] On 12 May 2011, Odersky and collaborators launched Typesafe, a company to provide commercial support, training, and services for Scala. Typesafe received $3 million investment from Greylock Partners.[8][9][10][11]

Scala comes to .Net | The Scala Programming Language
http://www.scala-lang.org/node/10299

Scala In 5 Years – My Prediction « GridGain – High Performance Cloud Computing
http://gridgaintech.wordpress.com/2011/06/28/scala-in-5-years-my-prediction/

Why Java Folks Should Look Forward to Scala | Javalobby
http://java.dzone.com/articles/why-java-folks-should-look

Scala eXchange opening
http://www.slideshare.net/Odersky/scala-exchange-opening

Ruminations of a Programmer: Composing Heterogeneous DSLs in Scala
http://debasishg.blogspot.com/2011/06/composing-heterogeneous-dsls-in-scala.html

Scala Labs – Home
http://scala-labs.github.com/

Spark Cluster Computing Framework
http://www.spark-project.org/
Spark is an open source cluster computing system that aims to make data analytics fast — both fast to run and fast to write.

Along Came Betty » Clojure and Akka: A match made in …
http://blog.darevay.com/2011/06/clojure-and-akka-a-match-made-in/?utm_source=twitterfeed&utm_medium=twitter

Scala: The Static Language that Feels Dynamic
http://www.artima.com/weblogs/viewpost.jsp?thread=328540

Compiling Scala to LLVM
https://days2011.scala-lang.org/sites/days2011/files/ws3-2-scalallvm.pdf

Why Java folks should look forward to Scala | /var/log/mind
http://blog.dhananjaynene.com/2011/05/why-java-folks-should-look-forward-to-scala/

Functional Languages will Rule (but not this year) – Good Stuff
http://goodstuff.im/functional-languages-will-rule-but-not-this-y

Scala: A Better Java for Android
http://robots.thoughtbot.com/post/5836463058/scala-a-better-java-for-android

Ruminations of a Programmer: Combinators as the sublanguage of DSL syntax
http://debasishg.blogspot.com/2011/05/combinators-as-sublanguage-of-dsl.html

Typesafe
http://typesafe.com/
Typesafe makes it easy to build web-scale software based on the open source Scala programming language and Akka middleware. From multicore to cloud computing, it’s purpose built for scale.

The Pragmatic Bookshelf | Programming Concurrency on the JVM
http://pragprog.com/titles/vspcon/programming-concurrency-on-the-jvm

InfoQ: Actor Thinking
http://www.infoq.com/presentations/Actor-Thinking

Clojure or Scala for bioinformatics/biostatistics/medical research – Stack Overflow
http://stackoverflow.com/questions/5250459/clojure-or-scala-for-bioinformatics-biostatistics-medical-research

InfoQ: Guardian.co.uk Switching from Java to Scala
http://www.infoq.com/articles/guardian_scala

Asynchronous Event Sourcing using Actors
http://jonasboner.com/2009/02/12/event-sourcing-using-actors.html

Functional Scala: Expressions, Extensions and Extractors « brain driven development
http://gleichmann.wordpress.com/2011/03/13/functional-scala-expressions-extensions-and-extractors/

iWork.com – JVM Languages
http://public.iwork.com/document/?d=JVM_Languages.key&a=p1045023190

Scala Team Wins ERC Grant | The Scala Programming Language
http://www.scala-lang.org/node/8579

Ruminations of a Programmer: Monads – Another way to abstract computations in Scala
http://debasishg.blogspot.com/2008/03/monads-another-way-to-abstract.html

Monads Are Not Metaphors – Code Commit
http://www.codecommit.com/blog/ruby/monads-are-not-metaphors

Algorithmically challenged: Sieve of Eratosthenes (the real one) Scala One-Liner
http://dcsobral.blogspot.com/2010/12/sieve-of-eratosthenes-real-one-scala.html

Code Monkeyism: Singletons without Singletons: Scala Type Classes
http://codemonkeyism.com/singletons-singletons-scala-type-classes/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+stephansblog+%28Code+Monkeyism+%7C+Stephans+Blog%29

Erik Engbrecht’s Blog: Higher-Level versus Higher-Order Abstraction
http://erikengbrecht.blogspot.com/2010/07/higher-level-versus-higher-order.html

Ruminations of a Programmer: Scala – To DI or not to DI
http://debasishg.blogspot.com/2008/02/scala-to-di-or-not-to-di.html

Real-World Scala: Introduction
http://jonasboner.com/2008/10/01/real-world-scala-introduction.html

Tom Morris’ wiki » Scala for Hackers
http://tommorris.org/wiki/Scala_for_Hackers

Scala Style Guide
http://davetron5000.github.com/scala-style/

Monads in Scala
http://lamp.epfl.ch/~emir/bqbase/2005/01/20/monad.html

Building Distributed Systems in Scala
http://www.slideshare.net/al3x/building-distributed-systems-in-scala

James Carr » Blog Archive » Learning Scala: Factorials and foldRight
http://blog.james-carr.org/2010/05/31/learning-scala-factorials-and-foldright/

Scala Beauty – Fun with Logic « Thinkmeta
http://thinkmeta.wordpress.com/2010/03/25/scala-beauty-fun-with-logic/

Beyond Mere Actors
http://docs.google.com/present/view?id=ddmk3f43_63zpg3jcgz&ncl=true

My Links
http://www.delicious.com/ajlopez/scala
http://www.delicious.com/ajlopez/scala+tutorial
http://www.delicious.com/ajlopez/scala+presentation
http://www.delicious.com/ajlopez/scala+video

More Scala links are coming.

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

January 6, 2012

Content Repository: Links, News and Resources (1)

Filed under: AjCoRe, Content Repository, Java, Links — ajlopez @ 5:35 pm

Recently, I was working on my open source simple content repository, AjCoRe, having nodes and properties, based on the JSR-170 concepts. Now, I’m reading some additional resources: API, concrete implementations, uses cases, etc. This is the list of links I have collected about the topic:

http://en.wikipedia.org/wiki/Content_repository

A content repository is a store of digital content with an associated set of data management, search and access methods allowing application-independent access to the content, rather like a digital library, but with the ability to store and modify content in addition to searching and retrieving. Acontent repository thus typically forms the technical underpinning of a content application, like a Content Management System or a Document Management System. It functions as the logical storage facility for content

A content repository exposes amongst other the following facilities:

  • Read/write of content
  • Hierarchy and sort order management
  • Query / search
  • Versioning
  • Access control
  • Import / export
  • Locking
  • Life-cycle management
  • Retention and hold / records management

What is Java Content Repository
http://onjava.com/pub/a/onjava/2006/10/04/what-is-java-content-repository.html?page=1
The Java Content Repository API (JSR-170) is an attempt to standardize an API that can be used for accessing a content repository. If you’re not familiar with content management systems (CMS) such as Documentum, Vignette, or FileNet, then you must be wondering what a content repository is. Think of a content repository as a generic application "data store" tht can be used for storing both text and binary data (images, word processor documents, PDFs, etc.). One key feature of a content repository is that you don’t have to worry about how the data is actually stored: data could be stored in a RDBMS or a filesystem or as an XML document. In addition to providing services for storing and retrieving your data, most content repositories provide advanced services such as uniform access control, searching, versioning, observation, locking, and more.
Introducing the Java Content Repository API

http://www.ibm.com/developerworks/java/library/j-jcr/

JCR Primer
http://jtoee.com/jsr-170/
The following pages contain a primer on the Java Content Repository specification.
JSR170, the Java Content Repository, constitutes an extremely complex specification. The successor, JCR 2.0 / JSR 283, specification adds even more complexity. However, the JCR REPRESENTS a very generic and object-oriented content repository which touches almost all features known in the space. The content repository is not a full-fledged content management system or a content management API. It is only the small subset of a content repository, a storage engine, which a content management system can be built on top of.

Java Content Repository: The Best Of Both Worlds
http://java.dzone.com/articles/java-content-repository-best

Compact Node Type Notation in a Nutshell
http://jtoee.com/jsr-170/compact-node-type-notation-in-a-nutshell/

Content Management with Apache Jackrabbit
http://www.slideshare.net/jukka/content-management-with-apache-jackrabbit

JCR In Action
http://www.slideshare.net/cziegeler/jcr-in-action-apachecon-us-2009
Content-based Applications with Apache Jackrabbit

Apache Jackrabbit Examples
http://wiki.apache.org/jackrabbit/ExamplesPage

Introducing the Alfresco Java Content Repository API
http://wiki.alfresco.com/wiki/Introducing_the_Alfresco_Java_Content_Repository_API
This article introduces you to the Alfresco implementation of the Java Content Repository API (aka JCR or JSR-170) by designing and developing a simple WIKI like back-end using both Level 1 and Level 2 JCR features.

Oracle Beehive Java Content Repository
http://docs.oracle.com/cd/E13789_01/bh.100/e13801/toc.htm

Catch Jackrabbit and the Java Content Repository API
http://www.artima.com/lejava/articles/contentrepository.html

The SharePoint content repository: It’s just a database
http://searchwinit.techtarget.com/feature/The-SharePoint-content-repository-Its-just-a-database
SharePoint’s repository — where all its content lives, is indexed, and is version-controlled — isn’t some special data construct. It’s just a database — a SQL Server database, to be specific.

Apache Sling – Bringing Back the Fun
http://sling.apache.org/site/index.html
Apache Sling in five bullets points:
- REST based web framework
- Content-driven, using a JCR content repository
- Powered by OSGi
- Scripting inside, multiple languages (JSP, server-side javascript, Scala, etc.)
- Apache Open Source project

Apache Jackrabbit
http://en.wikipedia.org/wiki/Apache_Jackrabbit
Apache Jackrabbit is an open source content repository for the Java platform. The Jackrabbit project was started on August 28, 2004, when Day Software licensed an initial implementation of the Java Content Repository API (JCR). Jackrabbit was also used as the reference implementation of JSR-170, specified within the Java Community Process. The project graduated from the Apache Incubator on March 15, 2006, and is now a Top Level Project of the Apache Software Foundation.

Content Repository API for Java
http://en.wikipedia.org/wiki/Content_repository_API_for_Java

Content repository like JSR-170 in .net?
http://forums.asp.net/t/1201446.aspx/1

Sensenet
http://www.sensenet.com/
Open Source Sharepoint Alternative

Eclipse Enterprise Content Repository
http://www.slideshare.net/efge/eclipse-enterprise-content-repository-ecr
Overview of Nuxeo Core

IIOP enabled jackrabbit-jcr-rmi, .NET 2.0 Remoting Layer Implementation, .NET 2.0 Repository Explorer implementation, .NET 2.0 implementation of JSR-170 API
https://issues.apache.org/jira/browse/JCRRMI-24

JSR 283: Content Repository for JavaTM Technology API Version 2.0
http://jcp.org/en/jsr/detail?id=283

JCR or RDBMS
http://www.scribd.com/doc/11163161/JCR-or-RDBMS-why-when-how
Why, when, how?

My own work, AjCoRe
http://ajlopez.wordpress.com/category/ajcore/

My Links
http://delicious.com/ajlopez/contentrepository

More work on AjCoRe is coming.

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

December 9, 2011

Clojure: Links, News and Resources (3)

Filed under: Clojure, Java, Links, Lisp, Programming Languages, Web Development — ajlopez @ 1:43 pm

Previous Post
Next Post

More links about Clojure, this time, oriented to Web Development:

Conjure
https://github.com/macourtney/Conjure
A Rails like framework for Clojure

Building a Clojure Web application with Incanter, Compojure, and Leiningen
http://data-sorcery.org/2009/11/29/incanter-webapp/

Cascade
https://github.com/hlship/cascade/wiki/
Cascade is an action-oriented web framework written in idiomatic Clojure

Benefits of using Clojure (Lisp) in web/enterprise development
http://bitumenframework.blogspot.com/2009/09/benefits-of-using-clojure-lisp-in.html

a minimal web app
http://www.learningclojure.com/2009/09/minimal-web-app.html

Snakes on the Web
http://jacobian.org/writing/snakes-on-the-web/

sjl / newseasons
https://github.com/sjl/newseasons
A simple Clojure webapp for notifying users when new seasons of their favorite TV shows hit iTunes.

One syntax to rule them all
http://wagjo.blogspot.com/2011/07/one-syntax-to-rule-them-all.html

Hello Web : Dynamic Compojure Web Development at the REPL
http://www.learningclojure.com/2011/03/hello-web-dynamic-compojure-web.html

Clojure on Heroku with Noir and Mongo in 10 minutes
http://thecomputersarewinning.com/post/clojure-heroku-noir-mongo

ulsa / cljvaadin
https://github.com/ulsa/cljvaadin
Sample Vaadin web app using Clojure

Noir
http://www.webnoir.org/
The Clojure web framework

Deploying a Clojure web app on Heroku
http://blog.jayway.com/2011/06/13/deploying-a-clojure-web-app-on-heroku/

Tackling my first Clojure project, a Graphical HTTP Benchmarker
http://blog.andrewvc.com/tackling-my-first-jlojure-project-a-graphical

A BRIEF OVERVIEW OF THE CLOJURE WEB STACK
http://brehaut.net/blog/2011/ring_introduction

Clojure on Heroku
https://gist.github.com/1001206

dbyrne / 4clojure
https://github.com/dbyrne/4clojure/
An interactive problem website for Clojure beginners.

The Universal Server
http://vimeo.com/21825857
In this code cast I demonstrate the awasomeness of dynamic programming languages by showing how to interactively create and use a universal server, inspired by Joe Armstrong.

Reddit Clone in 10 minutes and 91 lines of Clojure
http://bestinclass.dk/index.clj/2010/02/reddit-clone-in-10-minutes-and-91-lines-of-clojure.html

Interactive Web Development with Clojure
http://charsequence.blogspot.com/2010/09/interactive-web-development-with.html

Building REST APIs for Clojure Web Applications
http://mmcgrana.github.com/2010/08/clojure-rest-api.html

Developing and Deploying a Simple Clojure Web Application
http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html

Clojure Web Development with Ring
http://mmcgrana.github.com/2010/03/clojure-web-development-ring.html

My Links
http://delicious.com/ajlopez/clojure+webdevelopment

More link about Clojure and Lisp are coming.

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

November 3, 2011

Clojure: Links, News and Resources (1)

Filed under: .NET, Clojure, Java, Links, Lisp — ajlopez @ 9:03 am

Next Post

Clojure is a bit topic, for me. I didn’t send any geek early links email dedicated to it. To start engines, this is a list of Clojure presentations, videos, discussions at Infoq

http://en.wikipedia.org/wiki/Clojure

Clojure (pronounced like “closure[2]) is a recent dialect of the Lisp programming languagecreated by Rich Hickey. It is a general-purpose language supporting interactive development that encourages a functional programming style, and simplifies multithreadedprogramming.

Clojure runs on the Java Virtual Machine and the Common Language Runtime. Like other Lisps, Clojure treats code as data and has a sophisticated macro system.

Simple Made Easy
http://www.infoq.com/presentations/Simple-Made-Easy
Rich Hickey emphasizes simplicity’s virtues over easiness’, showing that while many choose easiness they may end up with complexity, and the better way is to choose easiness along the simplicity path.

Clojure Web Frameworks Round-Up: Enlive & Compojure
http://www.infoq.com/news/2011/10/clojure-web-frameworks
Clojure is rather new member of the LISP family of languages which runs on the Java platform. Introduced in 2007 it has generated a lot of interest.

Clojure: The Art of Abstraction
http://www.infoq.com/presentations/Clojure-The-Art-of-Abstraction
Alex Miller presents some of the abstractions that make Clojure a great language: Collections, Sequence and Higher Order Functions, Multimethods, Protocols, Atoms, Macros, and others.

Perception and Action: An Introduction to Clojure’s Time Model
http://www.infoq.com/presentations/An-Introduction-to-Clojure-Time-Model
Stuart Halloway discusses how we use a total control time model, proposing a different one that represents the world more accurately helping to solve some of the concurrency and parallelism problems.

Clojure-Java Interop: A Better Java than Java
http://www.infoq.com/presentations/Clojure-Java-Interop
Stuart Dabbs Halloway, after reviewing Clojure’s syntax comparing it with Java, explains how Clojure-Java interoperability works. He then talks about the need for simplicity in languages, attempting to prove that Clojure is a simpler language, and consequently better, than Java.

Writing HTML5 Applications with Google App Engine, Google Closure Library and Clojure
http://www.infoq.com/news/2010/11/html5-gae
Clojure works internally with Key/Value pairs. We can retrieve them to and from the Google Datastore, and we can send them to the client as JSON.

Rich Hickey on Protocols and Clojure 1.3
http://www.infoq.com/interviews/hickey-clojure-protocols
Rich Hickey explains the ideas behind Clojure 1.2′s new polymorphism constructs deftype and protocols. Also: Clojure 1.3 features such as faster arithmetic and future features like Pods.

Book Excerpt and Interview: The Joy of Clojure
http://www.infoq.com/articles/the-joy-of-clojure
The Joy of Clojure by Michael Fogus and Chris Houser is a book that tries to take the reader beyond the language syntax, and show how to write fluent, idiomatic Clojure code. It teaches how to approach programming challenges from a Functional perspective and master the Lisp techniques that make Clojure so elegant and efficient.

Clojure’s Solutions to the Expression Problem
http://www.infoq.com/presentations/Clojure-Expression-Problem
Chris Houser presents the expression problem showing two ways to solve it in some languages, followed by a demonstration of solving it using multimethods and protocols in Clojure, mentioning pros and cons of each solving method.

Functional Languages 101: What’s All the Fuss About?
http://www.infoq.com/presentations/Functional-Languages-101
Rebecca Parsons makes an basic introduction to functional languages, explaining how to think in a functional language, why is there renewed interested in them, and some nifty things about these languages.

Exploring LISP on the JVM
http://www.infoq.com/articles/lisp-for-jvm
One of the most exciting things in the Java world right now is the work being done to get other programming languages to run on the virtual machine. There is a lot of buzz around JRuby, Groovy, Scala, and the JavaScript engine Rhino. But why stop there? If you really want to take a step outside the mainstream and dive into something completely different from Java, Lisp is a great option. And there are several open-source implementations of the Lisp programming language for the JVM out there, ready to be explored.

Clojure in the Field
http://www.infoq.com/presentations/Clojure-in-the-Field
Stuart Halloway presents what makes Clojure different and, in his opinion, better than Java, plus some real-life lessons on Clojure development including BDD for functional code, wrapping Java APIs, third part libraries worth knowing, writing code without an objectual context, and the learning curve for a team new to the language.

An In-Depth Look at Clojure Collections
http://www.infoq.com/articles/in-depth-look-clojure-collections
If you’re familiar with the Clojure programming language, then you might know that at its heart lays a powerful set of immutable, persistent, collection types.In this article we will talk a bit about the underpinnings of these collection types including a deep dive into a couple of them; namely its vectors and maps. Finally, we’ll wrap up by presenting an example of how viewing a problem through the lens of the Clojure way we can vastly simply our design.

Stuart Halloway on Clojure and Functional Programming
http://www.infoq.com/interviews/stuart_holloway_clojure
Relevance, Inc. co-founder Stuart Halloway discusses Clojure and functional programing on the JVM in depth, and touches on the uses of a number of other modern JVM languages including JRuby, Groovy, Scala and Haskell. He also makes a case for structural edit modes in IDEs, and shares some of his favorite IT books.

Dean Wampler on Programming Languages
http://www.infoq.com/interviews/wampler-programming-language
This interview begins with a discussion of functional programming, the use of Scala by programmers trained in Java and the differences between purely functional languages like Haskell and hybrids like Scala. Later in the interview other programming languages are discussed along with the notion of programming paradigms and the need for combining both paradigms and languages to best solve problems.

Are We There Yet?
http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
In his keynote at JVM Languages Summit 2009, Rich Hickey advocated for the reexamination of basic principles like state, identity, value, time, types, genericity, complexity, as they are used by OOP today, to be able to create the new constructs and languages to deal with the massive parallelism and concurrency of the future.

Persistent Data Structures and Managed References
http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey
Rich Hickey’ presentation is organized around a number of programming concepts: identity, state and values. He explains how to represent composite objects as values and how to deal with change and state, as it is implemented in Clojure.

Clojure and Rails – the Secret Sauce Behind FlightCaster
http://www.infoq.com/articles/flightcaster-clojure-rails
Clojure is a LISP for the JVM created by Rich Hickey. Over the past year it has gained a lot of attention, mostly due to its concurrency features such as support for Software Transactional Memory (STM) and other powerful data structures. The recent rise of interest in functional languages also didn’t hurt. A few months after the release of Clojure 1.0, real world projects implemented in Clojure are now appearing.

Clojure
http://www.infoq.com/presentations/hickey-clojure
In this presentation from the JVM Languages Summit 2008, Rich Hickey discusses Clojure, which is an implementation of Lisp. Topics covered include Clojure features and syntax, example code, interoperation with Java, Clojure and functional programming, persistent data structures, concurrency semantics, references, transactions, software transactional memory, agents, implementation and pain points.

My Links
http://delicious.com/ajlopez/clojure+infoq

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

November 27, 2010

A minimal Http Server in Java

Filed under: Java — ajlopez @ 6:53 pm

Recently, I wrote an spike, implementing a minimal Http Server in Java. It’s naive, and it don’t implement all the protocol: only the minimal GET.

The code:

package com.ajlopez;
import java.io.*;
import java.net.*;
public class HttpServer {
    public static void main(String[] args) {
	int port;
	ServerSocket serversocket;
		
	port = Integer.parseInt(args[0]);
	String rootpath = args[1];
		
	try {
		serversocket = new ServerSocket(port);
	} catch (IOException e) {
		e.printStackTrace();
		return;
	}
		
	while (true) {
	    try {
		Socket socket = serversocket.accept();
		BufferedReader reader = new BufferedReader(
                          new InputStreamReader(socket.getInputStream()));
		String line = reader.readLine();
		String [] words = line.split(" ");
		System.out.println(line);
		InputStream stream = new FileInputStream(rootpath + words[1]);
		OutputStream output = socket.getOutputStream();
		byte [] buffer = new byte[4096];
		int nbytes;
			
		while ((nbytes = stream.read(buffer))!=-1)
		    output.write(buffer,0,nbytes);
		
		output.close();
		stream.close();
		socket.close();
	    } catch (IOException e) {
		e.printStackTrace();
	    }
	}
    }
}

It receives two arguments: the port and the root directory. You can try

java com.ajlopez.HttpServer 10000 c:\apache-tomcat-6.0.18\webapps\docs

and enter

http://localhost:10000/index.html

(don’t forget the index.html) and you get:

It’s toy code, but it works ;-)

You can get it from pastie:

http://pastie.org/1305444

or download from my AjCodeKatas google code:

http://code.google.com/p/ajcodekatas/source/browse/#svn/trunk/Spikes/MinimalHttpServer

I could improve it: separate concerns, add multithreading, etc.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

Older Posts »

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 28 other followers