Adventures in Clojurescript & React at Devoxx 2017

Join me for the Adventures in Clojurescript & React workshop at Devoxx 2017 on Friday 12th May, in Lab Room B from 11.15am until 1.15pm.

Together we will build a client-side web app using a React library and Clojurescript. Along the way I’ll cover the theory of React and the features of Clojurescript that make it a great language for development.

Read on to find out how to prepare for the workshop.

Read More

Call for Speakers: London Clojurian Conference 2016

December 2016 we celebrate the sixth birthday of ClojureX, a two-day conference organised by the London Clojurians and SkillsMatter. Submit your talk ideas by 30th August to take part in the fun.

ClojureX CFP deadline - 30th August

Previous conferences have included a diverse range of topics and speakers in the areas of Clojure, Clojurescript and Functional Programming. At last years conference we were quite surprised how many people are already using Clojure at work. In 2014 we ran a poll of our audience and 18% were using Clojure on a daily basis. For the same poll in 2015, 78% were using Clojure for their daily work. What will the 2016 poll reveal?

The London Clojure community continues to grow and we want to hear all your stories and learn from your experiences, no matter how long you have been working with Clojure. So please consider submitting a talk (or several talks) to the ClojureX conference in London on the 1st & 2nd December.

If you have never spoken before or want some handy hints on presenting and getting your talk accepted for Clojure eXchange, then join our workshop on Giving your first Meetup or Clojure eXchange talk on 2nd August, 2016 (video coming soon).

Anyone accepted to speak at the Clojure eXchange conference gets a free ticket, or re-imbursed if you have already purchased a ticket. You also get a free ticket for a friend. A 25% discount on ticket purchase for anyone who submits to the CFP but does not get accepted.

Read More

Thinking Functional With Clojure at DevoxxUK 2016

Many languages new and old provide a way to write code using functional programming concepts, however learning those concepts can take a little time especially when they are joined with OO concepts in the same language.

As Clojure has a simple syntax, many find it easier to focus on learning the concepts and design of functional programming. Then either taking those concepts back to other languages or continuing with Clojure.

At DevoxxUK 2016 I have the pleasure of running a workshop where I can help developers understand the core functional concepts, using Clojure (and Spacemacs) as simple tools.

Read More

EuroClojure - Developers Get Musical With Overtone

Sam Aaron and Jeff Rose gave a whirlwind tour of creating music with Overtone, an open source music generator written in Clojure.

You can define your own instruments, map keyboards and other synthesiser hardware, all to make some funky sounds - although you probably want to have headphones on when experimenting!

@samaaron with overtone you can sit on a train and make musicI had fun creating my first overtone project from scratch at the last Overtone Hackday. Have a look at how I set up my environment.

The Design of Overtone

Music is not a very easy concept to define in software. Typically you start with a synthesiser and work your way up to notes and chords. Eventually you may get to a music piece, but this is often driven by a hardware keyboard and recorded.

The difficulty is that everyone has a different idea of how to describe music.

Overtone comes in two parts. The Super-Collider generates all the sounds from over 500 midi building blocks, essentially you create a directed graph that returns values to represent those sounds. The clojure project part allows you to define instruments (synthesisers) and orchestrate these instruments together.

Basic approach to making music

Overtone generally works on the principle of subtractive synthesis. You create a number of different sounds by defining individual instruments and by adjusting the time and frequency of the sound wave to vary the sounds produced.

Once you have some instruments, then adding an envelope generator will give you a changing sound through time by, essentially multiplying the sound by the envelope.

Join sounds together by creating a player function that takes a time and plays the instruments - adding durations to the sound.

To spice up your sounds you can then experiment with playing two different frequencies at the same time, referred to as multi-channel expansion. A resident low pass filter is also fun to experiment with.

Sam and Geoff showed off what they call the stepinator, which seems to emulate a square wave form which steps through a series of values over time. This created some Buck Rogers style music.

Eventually you will want to use an external keyboard or some hardware device to pay your music as calling functions over and over again from within the REPL will only get you so far. If you map functions, frequencies, etc to the external player controls then you can play your clojure code..

Getting Visual

To make the music come alive even more, you can use the Java processing framework. Instead of calling processing directly, you can use the clojure project Quil to visualise the overtone sounds, creating a sphere and controlling the size of the sphere with the different frequencies of the sounds.

Get collaborative

Sam and Geoff are trying out different ways of sharing the REPL so they can jam together. Many people are sharing their sounds on freesound.org, a collaborative database of Creative Commons Licensed sounds. Browse, download and share sounds

Get started

Read the Overtone documentation to get started or have a look at my setup on Ubuntu. Dont forget to experiment.

Thank you.
@jr0cket


This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket
Creative Commons License

Keep Calm and Use Clojure

A really nice april fools from Cake Solutions. I actually think this works quite nice as a sound-byte for the Clojure functional programming language on the JVM.

There are lots of scarily possible april fools stories on Slashdot, although they are funny its disturbing how close some of them are to the truth.

My favourite april fools video is from the Bitbucket team, making light of developers who are weary of pair programming… I definitely have to get myself one of these t-shirts.

Thank you.
@JR0cket


This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket
Creative Commons License

Learning Clojure Through Practice - London Clojurians February Dojo

Another chance to practice Clojure with the help of the great people that are part of the London Clojurians community. Each person at the dojo has a different experience with Clojure and functional programming, so there is always something different to learn. It still amazes me how much I learn and how confident each dojo makes me (by the end of the night anyway).

Read More

Battleships at London Clojure Coding Dojo - January 2012

Its not quite Global Thermo Nuclear War, but battleships was a great choice for a coding dojo topic. Its a simple enough game and therefore a challenge that you feel you can tackle within one evening. Its also a game that most people know and have fond memories, so the discussions have lots of context.

If you are not familiar with the Battleships game, please see the Wikipedia page on Battleships.

At the January 2012 dojo we used a battleships server created by Neill Alexander and Robert Rees kindly facilitated the night. The battleships server allows you to submit your “player” and proceeds to play battleship games against is own player - CPU1 (shame the player is not called Master Control Program so I could slip in a Tron reference).

To get started with the dojo I forked the project on Github to my own account and cloned the project repository to my local machine. I still use the command line to clone remote repositories, its pretty straight forward:

git clone url local-folder-name

For my fork of the battleships game the command becomes

git clone https://github.com/jr0cket/battleships

When I clone a github repository that I have forked from someone elses repository I prefix the local folder name with my username so I know its my fork and not the original - saves a lot of hassle wondering why I cant push changes back to github directly

The project is on my local computer I can fire up leiningen build tool and get the project running. First thing to do is to make sure I have all the libraries the project depends upon. Leiningen will download the Internet of jars for me (just like maven) with the following command:

lein deps

The battleships project uses Clojail to create a sandbox, so its important to set the Java runtime environment security permissions. There is a handy lein task for this courtesy of Robert Rees that creats a .java-policy document in the … file:

lein policy

Or you can just create the file with any handy text editor.

I then fire up Emacs from within the top level project directory (makes it quicker to find my project files) and opened emacs with the project.clj file to see how the project is set up.

emacs project.clj &

Clojure has a repl for working with the language dynamically, so I fire the REPL server up using emacs (of course). Adding clojure-mode to emacs 24 gives you the swank REPL server - allowing you to call clojure-jack-in and fire up a swank REPl server using the lein project.clj project definition. I defined a keyboard shortcut Ctrl-c, Ctrl-j for the M-x clojure-jack-in command in the .emacs.d/config.el emacs configuration file.

I then open the relevant clojure code using the keyboard shortcut Ctrl-c Ctrl-f. For the dojo I just needed to work with the demo.clj file that defines a battleship player: jr0cket-battleships/src/battleships/demo.clj

Once the project is loaded into emacs and swank is running, load the battleships namespace into the swank server using the (use ...) function.

Note that (use) will load in all the required dependencies at once whereas (requires) will also require you add all the dependencies yourself.

user+> (use :reload-all '[battleships.client :as client])
nil

For the dojo we had a central server that we all submitted to. I also spun up a local battleships server so I could do some testing.

lein ring server

Now I am in the namespace I can submit the player I created - initially this was just the default demo.clj player as I was interested in a baseline player to work with. By default the demo.clj player will shoot and place your ships at random, with no intelligence to these
actions

user> (submit-player "src/battleships/demo.clj" "baseline" "http://localhost:3000")
Submitting to http://localhost:3000/create
    {:status 200, :headers {"date" "Tue, 31 Jan 2012 21:24:18 GMT", "content-type" "text/html; charset=utf-8", "connection" "close", "server" "Jetty(6.1.25)"}, :body "player1912"}

When submitting your “enhanced” player you should give it a name you will remember, different from other players. As the game does not replay any matches, its probably worth submitting a new player rather than updating an existing one (there would have to be a lot of players to overload the server!).

user> **(submit-player "src/battleships/demo.clj" "Masher001" "http://localhost:3000")**
Submitting to http://localhost:3000/create
{:status 200, :headers {"date" "Tue, 31 Jan 2012 21:24:18 GMT",
"content-type" "text/html; charset=utf-8", "connection" "close",
"server" "Jetty(6.1.25)"}, :body "player1912"}

If you are playing against each other in teams, then the server address will be the IP address of a shared server.

Now the clojure fun begins. Using the demo.clj as a basis, modify your player so it wins all the games, or at least stop it from sucking more than everyone else’s player.

So if you want to have some Clojure fun with Battleships, go make your own fork of the Battleships server and get coding!

Thank you.
@jr0cket


This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket
Creative Commons License