"The Grid. A digital frontier. I tried to picture clusters of information as they move through the computer. What did they look like? Ships? Motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I’d never see. And then, one day, I got in." — Tron: Legacy

2013-05-31

Clojure on Android, quick intro

This time I'll show how to create Android application using Clojure programming language. Clojure is one of the most interesting practical functional languages ​​(in contrast e.g. to Haskell). It's a Lisp, so you can just run it and start hacking. This language makes it easy to play with code and stimulates curiosity.


It's just a very short intro to the configuration and ho to run basic program. For the impatient who want more I recommend a look at the neko library here: https://github.com/alexander-yakushev/neko


2013-05-28

Clojure na Android Intro

Tym razem wstępniak do tworzenia aplikacji na Androida przy użyciu języka programowania Clojure. Clojure to jeden z ciekawszych praktycznych języków funkcyjnych (w przeciwieństwie np. do Haskella). Jako, że to Lisp, można go po prostu uruchomić i zacząć hackować. Język ten ułatwia zabawę z kodem i stymuluje ciekawość. Clojure promuje eksperymentowanie. Z resztą przekonaj się sam. 

To tylko króciutkie intro przedstawiające proces konfiguracji i uruchomienia środowiska. Dla niecierpliwych, którzy chcą więcej polecam zapoznać się z biblioteką neko: https://github.com/alexander-yakushev/neko . 

2013-05-06

Fetching images from any Web page using Clojure

As title says this post will be about downloading images from given page link.  To make this task a little easier I am using Enlive library available here: https://github.com/cgrand/enlive

There are primarily 4 main steps to do this. 
- read page source from given address
- parse it 
- find all <img> tags and store its src (image link) value
- use these links to fetch images directly and store them to disk

Because function that reads image from URL needs full address like: "http://..." I'm adding additional step: 
- check if image URL has a valid root

It means that if image link starts with "/" I must add Web page URL at the beginning.  

This is how it looks like in Clojure. Remember to add 
[enlive "1.1.1"] dependency to project.clj if you're using Leiningen. Also create target directory if it doesn't exist.

2013-05-01

Przyspieszanie skryptów Clojure


Z pewnością wiele osób stroni/unika używania Javy lub innego języka opartego o JVM do uruchamiania skryptów ze względu na bardzo powolny czas startu. Przede wszystkim dotyczy to programistów Clojure, którego rozgrzewka jest, można powiedzieć, baaaaardzo długa jak na wymagania małych skryptów i wręcz przekreśla jakiekolwiek pożyteczne zastosowanie. Jest jednak na to sposób. Trzeba zaprzęgnąć do roboty program o nazwie Drip ( dostępny na: https://github.com/flatland/drip ).

Drip po pierwszym uruchomieniu, które trwa podobnie długo jak zwykłe uruchomienie programu przy pomocy polecenia java, ładuje świeże środowisko Java do pamięci i do takiego czystego środowiska zapodaje program, który uruchamia się niemal natychmiast.