Text

:dev profile by default in nrepl.el

To activate :dev profile when doing M-x nrepl-jack-in:

(add-hook 'nrepl-mode-hook
      '(lambda ()
         (set-variable 'nrepl-server-command
                       "lein with-profile dev repl")))

Quote
"Re: «против назревших исторических тенденций идти невозможно» — «И этот странный “симулятор парламента”, над которым принято потешаться - медленно, неуклюже, со скрипом, но принимает вполне националистическую повестку и направление.» —и очень хорошо."

http://nataly-hill.livejournal.com/1777392.html


Tags: ru
Quote
"Единственной (но очень надёжной) гарантией сохранения РПЦ МП в её нынешнем виде является массовое неверие, оно же тотальный атеизм современного русского общества. Поскольку если бы хоть сколько-нибудь верующих людей было больше пяти процентов населения, они бы стали требовать церковных реформ."

http://krylov.livejournal.com/2866284.html


Tags: ru
Link

When listening to music, however, we are not just listening to a series of disconnected instants. Instead, the way things sound depends on the notes we have heard. In other words, we integrate over time


Tags: en music
Quote
"«Если мы устраним наказание за отступничество от ислама – ислам вообще прекратит существование. Ислам закончился бы сразу после смерти пророка, если бы не этот закон. То есть противостояние отступничеству – это то, что сохранило ислам до сегодняшних дней», — заявил египетский имам."

Секрет долговечности ислама


Audio

Some song name — generated by SoundHelix 0.5 (r665), build on 2012-10-07. Default XML configuration (SoundHelix-Piano.xml).


Tags: en music
Text

How to generate some music with SoundHelix and save it to MP3

  1. Download SoundHelix. It is an algorithmic random music composer distributed under a GPL license.
  2. Unpack the binary zip archive.
  3. Edit configuration file examples/SoundHelix-Piano.xml; uncomment midiFilename tag (to save results in midifiles/)
  4. mkdir midifiles
  5. Run as java -jar SoundHelix.jar examples/SoundHelix-Piano.xml -s 'Some song name'. Song name seeds the random number generator. A MIDI file is saved to midifiles/.
  6. Convert MIDI to WAV (install timidity++ and freepats if necessary): timidity midifiles/Some_song_name-device1.mid -Ow.
  7. Convert WAV to MP3 (install lame if necessary): lame --preset medium midifiles/Some_song_name-device1.{wav,mp3}.
  8. Important: tag MP3 as generated by SoundHelix, it is requested by the author; I use id3v2: id3v2 -a "$(java -jar SoundHelix.jar --version)" -t 'Some song name' -y $(date +%Y) -g 'Algorithmic Composition' midifiles/Some_song_name-device1.mp3

E voilà


Tags: en music linux
Text

Array abstraction in Clojure

A recent post by Mike Anderson motivated me to write down my own ideas about an ideal multi-dimensional array API in Clojure:

https://gist.github.com/4477420

Tl;dr:

  • numpy.ndarray is a success, we need something similar: a homogeneous, fixed-size, multi-dimensional array,
  • arrays as views is a cool idea,
  • we need a generic multi-dimensional array API first (without linear algebra and statistics); the objective is to make any array-like output consumable by any Clojure library,
  • proposed core API: get (random access), shape (=> vector), slice (=> arrays as views), reshape and index-map (index space transforms), map (lifting scalar functions), stack (composing arrays => arrays as views), apply-dim (dimensionality reduction), copy (force views, make contiguous mutable copies), to-ndarray (conversion from other collections, no-op conversion from another array); I suppose the core API to be a protocol (except for copy and to-ndarray),
  • candidates for the core API: element type query and conversion, search (argmin, argmax, etc), zero-copying sorting (argsort), partial and complete reductions,
  • utility functions: all the high-level operations expressed through the core API operations (transpose, flatten, cyclic-shift, etc), input-output functions (loadtxt,savetxt, imread, imwrite),
  • some implementations may provide linear algebra, statistics, image and signal processing algorithms; but they are optional (not part of the core API); it’s a good idea to standardize on them too.

The proposed core API is not orthogonal. Strictly speaking, reshape is not orthogonal to index-map, but it’s easier to implement as a separate function; apply-dim is redundant if we have slice and map, but I suppose some implementations may optimize it; slice can be merged with get; copy and to-ndarray can be merged too, no-op conversion may be moved to utilities.

Open questions:

  • what is the best choice for the “default” array implementations (what do copy and to-ndarray _usually_ produce?); ideally it should be able to accomodate any Clojure number as well as user-defined types like Complex.
  • if some functionality goes to utility functions (like transpose implemented via index-map), how do optimized array implementations overload them?

Text

My most used NumPy/SciPy functions

I analyzed my recent Python scripts, and it appears that the most used NumPy/SciPy symbols are:

  1. asarray by a large margin
  2. linspace, three times less often than asarray
  3. mean
  4. dot
  5. sqrt
  6. roll
  7. hstack
  8. float32 (that’s not a function, but a type)
  9. loadtxt
  10. linalg.norm
  11. arange (I use it four times less often than linspace)
  12. array (copy-by-default, much less used than asarray)
  13. where
  14. diff
  15. cumsum
  16. savetxt (two times less often than loadtxt)
  17. max
  18. cross
  19. sin
  20. ones

Overall, the most used functions

  • convert anything to array (mostly lists and nested lists)
  • do simple file input-output (loadtxt, savetxt)
  • construct new arrays from the existing blocks (hstack, roll…) and default arrays (ones, zeros, linspace, arange…)
  • do basic linear algebra (dot, cross, norm)
  • make common reductions (mean, cumsum, max, …)
  • broadcast function application (sqrt, sin, …)
  • define inter-element relations (roll, diff)

This may be useful to know when designing a custom array-like API (I still wish I had time to write a Clojure wrapper around Commons Math).

I counted only qualified and explicit imports (“import numpy as np”, “from nump import foo”). I didn’t count scripts which use from ... import *. That’s too much work for grep and sed. I also didn’t count use of array object’s methods. This would require static analysis of Python code.

Do you know tools for such an analysis?


Video

I watched this video probably 10 times already.

Silbergeier - Nina Caprez & Cedric Lachat (barakafilms38)


Tags: climbing en