Richard Dawkins
Richard Dawkins prompts me to a moral dilemma that is also a paradox: I want to worship Richard Dawkins as a god, but I can't because I am an atheist myself.
Richard Dawkins prompts me to a moral dilemma that is also a paradox: I want to worship Richard Dawkins as a god, but I can't because I am an atheist myself.
I must confess that two days ago I had no idea who George Carlin was. I got to know him only yesterday, thanks to one of @ampajaro's tweets announcing his death first thing in the morning. That was followed by a chain of entries coming from a few of the blogs I (helplessly try to) keep up with. I have read such striking superlatives about this comedian that I youtubed him. After watching a few of his routines I now feel that I have to share and honour his talent. So here you have two pieces of different shows by George Carlin. Caution — strong opinions (and language) ahead. The first video is basically about religion being a pile of bullshit (kudos, we need more of that nowadays):
The second video is a somewhat furious yet brilliant sermon against those who are against abortion. (I personally don't agree with all of what Carlin says in this video. I am not against abortion. But unlike most of other left-wing people I know, I am not that sure that I am undoubtfully in favour of abortion, either. Also, I don't buy the theory that equates abortion to women's rights, and to “the choice of one woman”. In any case, I'm an atheist and my position has nothing to do with religion, tradition or customs, so I very much support — and enjoy — Carlin's mockery of religion's mean and simplistic approach to abortion):
What I admire the most about George Carlin is the technique — the round,
perfectly-delivered script. He can speak for ten minutes without
stumbling over a single syllable, without humming or hesitating. Weaving
long enumerations of words or examples, putting the stress in the right
place and stopping precisely where required. And I love his strong and
brave position on issues as sticky as religion, politics, taboos,
gender, death, PC language and abortion. Even if at times he looks more
like a fanatical preacher than a comedian and some of his arguments seem
debatable to me. But hey, conservatism needs to be balanced. Don't miss
his “Seven dirty words"
routine
(“shit, piss, fuck, cunt, cocksucker, motherfucker, tits”), which
apparently caused a radio station to be sued and sparkled a major debate
about censorship in the American airwaves. Here, the video audio
in
YouTube.
Adorable stuff to shift your mood. My muxtape:
tripu.muxtape.com
On Sunday, two videos that struck me recently. One video for the left hemisphere of your brain. Mathematics, Japan and genius. Part of a documentary about the amazing Daniel Tammet.
The second video is aimed at your right hemisphere. So much beauty and so many ways to invoke it. Imogen Heap knows a few of them.
The other day I
wanted to have an overview of the size of a software project I'm working
on. The project is relatively big and involves quite a few languages and
technologies spread among different tiers. Because I just joined the
team there are tons of lines of code already written that I have not
even seen. So I felt the need to have at least a grasp of the size of
the codebase for each language and learn how programming languages
compare among them within the project. I came up with this very simple
Bash script,
getSizeStats.sh
.
It expects one or more directories as parameters. It finds all regular
files contained in the trees that hang from those directories. It then
adds up LOC for all files, grouping by the extension of the filenames.
The script assumes that the arguments are, or might be, local copies of
Subversion repos (that's why it excludes .svn
directories). While
running, the output line shows a counter for the number of files as they
are processed. Once finished, a list of LOC for each language (i.e. file
extension) sorted by LOC is created in /tmp/getSizeStats.sh.out
.
#!/bin/sh
TMP_DIR=/tmp/basename $0
TMP_OUTPUT_FILENAME=/tmp/basename $0
.tmp
OUTPUT_FILENAME=/tmp/basename $0
.out
if [ -d $TMP_DIR ]; then rm $TMP_DIR/* 2> /dev/null else mkdir $TMP_DIR fi
COUNTER=0
find "$@" -name "." | grep -v \.svn | while read j; do
if [ -f "$j" ]; then
cat "$j" >> $TMP_DIR/echo $j | rev | cut -s -d "." -f 1 | cut -d "/" -f 1 | rev
COUNTER=$((COUNTER + 1))
echo -en "\r$COUNTER files "
fi
done
if [ -f $TMP_OUTPUT_FILENAME ]; then rm $TMP_OUTPUT_FILENAME fi
for i in ls $TMP_DIR
; do
echo -e "wc -l $TMP_DIR/$i | cut -d " " -f 1
$i\twc -l $TMP_DIR/$i | cut -d " " -f 1
" >> $TMP_OUTPUT_FILENAME
done
sort -nr $TMP_OUTPUT_FILENAME | cut -d " " -f 2- > $OUTPUT_FILENAME rm $TMP_OUTPUT_FILENAME
echo processed -- see $OUTPUT_FILENAME
(I think that for some versions of echo
you'll have to remove the
option -e
or it won't work properly). The only serious problem I found
were filenames containing blanks and other characters that usually need
to be escaped (bad naming, I know — it wasn't my idea). I played with
different types of quoting and tried to find a workaround for that.
Real-time help about that from
@enlavin
and
@nauj27
was much appreciated. I tried that find -print0 | xargs -0 …
thing but
couldn't make it work as I needed. Eventually the while read j; do …
approach worked. (I confess that I still get confused easily by the
subtle differences between quoting variants and how variables get
expanded in each case. I ought to find some time to learn that well,
once and for all). Now there are so many things to improve here. First
of all, the script does not tell binary files from text files, i.e. you
will also get counts of “lines of code” for all binary assets within
your project, such as object files and images. It should also discard
all text files that are not source code, e.g. a CHANGELOG
. It should
be robust to case variations, i.e. group .java
and .JAVA
files
together. It should rely on something more sophisticated than filename
extensions to tell programming languages, because you probably want to
count your .cpp
and .c++
files as a whole. I was planning to better
it adding those fixes/improvements and others. Then
Golan told me of
sloccount
,
a command that does just what I need. But proper. Here you have an
example of how getSizeStats.sh
works. After re-inventing the wheel, I
couldn't but run my own script… against the source code of
sloccount
itself.
$ svn co https://sloccount.svn.sourceforge.net/svnroot/sloccount sloccount-src > /dev/null $ ./getSizeStats.sh sloccount-src/ 38 files processed -- see /tmp/getSizeStats.sh.out $ cat /tmp/getSizeStats.sh.out c 4493 orig 3899 html 3032 1 235 dat 197 l 171 rb 152 lhs 59 spec 56 h 50 CBL 31 php 27 inc 23 pas 21 hs 19 gz 10 f 10 cs 8 f90 7 cbl 4 tar 1
“The fact that all these [programming] languages are Turing-equivalent means that, strictly speaking, you can write any program in any of them. So how would you do it? In the limit case, by writing a Lisp interpreter in the less powerful language.
That sounds like a joke, but it happens so often to varying degrees in large programming projects that there is a name for the phenomenon, Greenspun's Tenth Rule:
‘Any sufficiently complicated C or Fortran program contains an ad hoc informally-specified bug-ridden slow implementation of half of Common Lisp.’
If you try to solve a hard problem, the question is not whether you will use a powerful enough language, but whether you will (a) use a powerful language, (b) write a de facto interpreter for one, or (c) yourself become a human compiler for one. […]
This practice is not only common, but institutionalized. For example, in the OO world you hear a good deal about ‘patterns’. I wonder if these patterns are not sometimes evidence of case (c), the human compiler, at work. When I see patterns in my programs, I consider it a sign of trouble. The shape of a program should reflect only the problem it needs to solve. Any other regularity in the code is a sign, to me at least, that I'm using abstractions that aren't powerful enough — often that I'm generating by hand the expansions of some macro that I need to write.”
If you are a software developer, a web designer or some other sort of techie it's very likely that you have been hearing and/or reading about Adobe Flex lately. Well, if you aren't using it yourself but feel curious about it, or if you just want to have a notion, this extremely quick introduction is for you. Skimming through this post will not turn you into a Flex developer, but it will allow you to nod confidently and even drop some canny words the next time that Flex pops up in a conversation around the watercooler. First things first — what Adobe Flex is not:
Flex in a nutshell (a rather small nutshell): Flex is an attempt by Adobe to make Flash attractive to, and suitable for, many software developers who were disregarding Flash as something not serious enough to use for developing “proper software”. Adobe has done a praiseworthy effort in that sense and has brought Flash to the realm of OO programming. Adobe used Eclipse to develop Flex Builder. Flex Builder alone does a lot to make old-skool software developers feel at home — it's a proper IDE with all the features you would expect, plus the extensibility (and the slowness, I'm afraid) of Eclipse. Flex developers use the Flex SDK (command line compilers and component class library; free as in “freedom”) and the Flex Builder (the IDE) to build their applications. Flex apps are written mainly in two languages:
The output of a Flex project is one or more Flash files (.swf
). In
terms of the approach to the development process, the single most
important change from Flash to Flex is probably removing the “movie”
way of thinking. Flash animators are used to the “movie paradigm” in
which the time is an essential concept. In their animations they have
been working with key concepts like “timeline”, “frame” and “loop”. Flex
abandons that approach. I have found that, in general, software
developers without any experience with Flash get used to Flex even
faster than Flash designers who don't know much about programming.
What Flex is good at:
What Flex is not good at:
Now, the “hello world” is mandatory, so here it goes. This application
simply displays a customised greeting (it's a “hello world” on
steroids). We'll make the GUI inherit from the layer that processes
the information, in a “code-behind” manner. First, the Actionscript
class contained in the file info/tripu/blog/flex/SimpleApp.as
. This
class extends the standard Application
class and defines what to do
with data:
package info.tripu.blog.flex {
import mx.controls.Alert;
import mx.core.Application;
public class SimpleApp extends Application {
public function greet (who:String): void {
Alert.show ('Hello, ' + who + '!');
}
}
}
Second, the MXML application HelloWorld.mxml
. It defines the GUI by
using an instance of the class SimpleApp
and adding a couple of visual
controls to it. Notice how the AS class that we created before is now
used straight as an XML element:
<?xml version="1.0" encoding="utf-8"?>
<tripu:SimpleApp xmlns:tripu="info.tripu.blog.flex.*" xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:TextInput id="user" text="world" />
<mx:Button label="Greet" click="{greet (user.text)}" />
</tripu:SimpleApp>
The result of compiling those two files in a Flex project is this Flash
file, HelloWorld.swf
(you'll need Flash Player version 8 or above to
see the embedded Flash object):
Today I ordered this little marvel:
Hopefully it will find its way from Japan to the UK and will be safe with me in a few days. Isn't it beautiful?
“A lot of these songs are just a response to what struck me as beauty. Whether it was a curious emanation from a being or an object or a situation or a landscape, you know, that had a very powerful effect on me as it does on everyone, and I prayed to have some response to the things that were so clearly beautiful to me; and there were a lot!”
Holy cow. Right after posting the previous entry I learnt that Leonard Cohen was inducted into the “Rock & Roll Hall of Fame”… only five days ago. That is good news for three reasons: a) it's good to check, from time to time, that L. Cohen is still alive; b) his appearance at the event proved that he is still brilliant with words and that the pitch of his voice has dropped down yet one more octave, entering the range of infrasounds; and c) there is still hope for a music industry that can spot an amazing lyricist among all the rubbish, and pay tribute to him even after so many years.
There are people whose soul vibrates in resonance at the same harmonics as Leonard Cohen's. For all those people (of whom, if my reckoning is right, there are exactly zero among the handful of readers of this blog) let me link a few items about Leonard Cohen that are dear to me: