Monday, April 20, 2009
10 things I like about python
-- OO is easy.
You can easily have as many public classes in your module. Create
classes on the fly.
-- List-comprehension
This is clearly stolen from Haskell, but even this seems to be
enhanced. Thought I miss the underscore.
-- self
self is your friend. With referring explicitly to the namespace, in
the long run, this clears things up.
-- Special methods
You don't have to use getters and setters. This is simply great!
-- Aesthetics
You don't need no braces around if, you can do 0 < x < 1, Python is
sexy code.
-- Procedures are first class citizens because you can
* store them in variables,
* use them as arguments,
* or results.
-- Jython, IronPython, CPython
You can use different platforms. You can even use it as a stored
procedure in your Oracle-Database.
-- Nested functions
lambda is really out if you want documented code. Just nest a function
inside of the function. It is called packaging.
-- SciPy and matplotlib
My other major is Econ, so I need to do computing for a living. What
is nicer, than to use your favorite PL for this.
-- Dynamics
Store the code as text in a database, reuse it, deploy it. If you are
creative, you can do a lot more than with a static language.
Dispatch the method
# I hate it, when I see something like this:
class Ape:
def __init__(self):
self.cnt = 0
def scream(self):
if self.cnt == 0:
print "uhgauhga!"
self.cnt += 1
else:
print "ahahah!"
return self
# Meh! You are programming OO. Let me alone with your dirty flow logic.
Ape().scream().scream()
# This monkey is doing it right.
class Monkey:
def scream(self):
print "uhgauhga!"
self.scream = self.scream2
return self
def scream2(self):
print "ahahah!"
return self
Monkey().scream().scream()
# Please just dispatch, after the first use!
Saturday, April 18, 2009
Nord-Amerika
Monday, April 13, 2009
Kinetik als Widerstand
Nachdem du einmal angefangen hast, die Processing-Kunstwerke zu
bestaunen, ist es schwer nicht mehr in Mustern, Animationen – der
Bewegung – zu denken. So denke ich nicht, dass es möglich ist, wieder in
eine Zeit der Statik, der Bewegungslosigkeit, zurückzukehren.
In meinem Studium viel mir auf, dass fortwährend ein Trend zur
Begegnung mit der Dynamik in jedem mir bekannten Zweig der
Wissenschaft stattfindet. In der Programmierung werden zumeist
vorerst Konstanten festgelegt, diese werden mit Fortschreiten des
Entwicklungszykluses zu Variablen.
Das Selbe gilt für die Märkte in den makroökonomischen Modellen. Bei
einfachen Simulationen werden approximative Konstanten gesetzt, die
nicht die komplette Wirklichkeit widerspiegeln, welche aber ein Modell
ermöglichen, mit dem sich Simulationen ermöglichen lassen.
Und so behaupte ich, dass jede Zeichnung ein Modell ist. Unsere
Wirklichkeit, abgebildet in einer zwei-dimensionalen Darstellung,
beliebig parallelisiert in Dimensionen, die das Sichtbare verlassen.
Dadurch, dass Bewegung immer mehr Bestandteil unseres Denkens wird,
entgegen von Marx glaube ich nicht an eine Entfremdung der Arbeit des
Menschen, wird auch die geheime, im mystischen Sinne, Reflexion zu
einem bewegten Werk.
Im Film herrscht teilweise die Stimmung der Statik vor. Storyboards
zwingen das Bild in eine unnatürliche Starre. Shoots werden
»photographiert«. Es ist, als würde der Film Probleme haben, sich als
selbständiges Medium durchsetzen zu können. Gerade um die Dynamik in
jedem Aspekt einfangen zu können, muss dieser Wandel geschehen.
Auch Präsentationen werden in der Manier von Storyboards geplant.
Doch findet diese in einem bewegten Kontext statt. Eine Anpassung der
Präsentationsmittel an die reale Situation würde, wie beim Free Jazz,
eine Freiheit in der Gestaltung ermöglichen.
Allerdings sehe ich hier die Schranken der Umsetzung. Wie in der
Programmierung stellt es ein großes Problem dar, Dynamismus darstellen
zu können. Nicht, dass wir nicht in bewegten Bildern denken können,
aber es fehlen schlichtweg die einfachen Mittel zur Erlangung eines
Produktes, welches einfach zu verwalten ist.
Flash und verschiedene Zooming-Werkzeuge existieren, aber sie sind einfach
zu primitiv. Können einfach Mechanismen der Abstraktion geschaffen
werden, die uns helfen, stärker in eine Richtung der puren Bewegung
vorzudringen?
Saturday, February 28, 2009
JavaScript: My hello world
Today I want to add more content to this blog that relates to the
programming languages that are written down on my CV. Many
programmers write down everything they had contact with, and claim
expertise. So I want to build up some petite portfolio, which is fun
to do anyways.
I want to start with a small application written in JavaScript (from
now on I will refer to it with JS). The
application should show a square and a little button should be at the
ground. After pushing the button the color will change randomly.
The development actually took me just half an hour. And every file
was validated. The first time I used JSLint. Which shows some real
shortcomings in JS. Why are there global objects? No import
Math or a declaration of a module. And functions have to be defined
with a var statement. This is pretty ugly.
Hm, the program is not so interesting after all. But better, than a
simple hello world. For the font I have used Georgia, because the
numbers align so nicely. The font changes after the algorithm
if ((rgb[0] + rgb[1] + rgb[2]) / 3 < 128) {
colorname.style.color = 'white';
} else {
colorname.style.color = 'black';
}
The only thing that is a bit interesting here. The use-case? You
need a color quickly and click until you find a nice one.
You can download the program under package. Unzip and open index.html.
Monday, February 23, 2009
Alternative Energien
Zusammenfassung: Dieser Text soll die unsicheren Prämissen untersuchen, welche sich bei der Untersuchung von alternativen Energien nach diesem Artikel ergeben. Keineswegs ist dies vollständig oder umfassend. Aber es werden Ansätze aufgezeigt.
Senkung des Energieverbrauchs um 11%
Dies ist möglich, wenn Energie genauso teuer wird, wie sie
nachhaltig kostet (Risiko, Entsorgung). Bei entsprechender Erhöhung
der Preise wird die Nachfrage sinken. Andere Technologien werden
wirtschaftlicher werden. Ein Beispiel hierfür ist das Passivhaus.
Kritik der Effizienzsteigerung
… fraglich, da formuliert vom Vertreter der RWE AG. Muss geprüft werden. Außerdem kann als Alternative auch einfach die Effektivität hinterfragt werden. Die richtigen Dinge tun. Kein Fernsehen, keine Tiere essen, … Außerdem formuliert es Stefan
Schurig vom World Future Council so: »the best law of its kind worldwide.«
Leitungen reichen nicht aus
Fehlende Angaben der Quelle, die das Gegenteil darstellt. Eine Quelle ist vorhanden – die kritisierte.
Repowering unwirtschaftlich
Dies ist abhängig vom Preis des Stroms. Fehlende Investoren heute,
heisst nicht, dass es wirklich für immer unwirtschaftlich ist.
Resume
Niemand sagt, dass die Ziele nicht hoch gesteckt sind. Aber Wandel
ist wichtig und machbar.
Literatur
Alle Links wurden das letzte Mal am 23.02.2009 abgerufen.
Eine fachlichere Gesamtanalyse
Moderne Turbinen brauchen zwei bis drei Monate, bis sie sich lohnen – die Turbinen von 1980 sechs Monate.
Artikel
Typische Return on Investment ist ein Jahr.
Der Wikipedia-Artikel hierzu.
Erklärung der allgemeinen Mythen.
Friday, January 9, 2009
This will be a shorter note, because I ain't got my coffee yet. But
let me note one thing about our daily conversations: They are not
science. A lot of people confront their normal conversation with the
conversations they are doing then they are working or do precious
stuff. Let me give you one example: In a scientific conversation --
may it be a thesis, or a presentation or even a talk, you have a clear
distinctions between the words. Everything is bound to be defined and
there shouldn't be any double meaning. This is why we have to write
down so many stuff to make things clear, have to build upon a great
fundament that is safe. Safe to talk about the things in the right
way.
But then there is the normal conversation, the real jazz. A
meta-language of its like. I don't bother to define everything right.
In fact it's just talking. Isn't it sometimes we are thinking about
the map of words like, you got me a map. With clear borders and
nothing is something like a doubled thing, meaning something else. I
think it is all about our more and more complex life leading to
expertise in many areas where we are not, well experts.
The enlightenment, or the thought of the enlightenment brought us to a
thought most liberals and capitalists advocate nowadays: The thought
that the individual knows best what's right in exactly this
situation. This thought is just plain wrong. It is not. Because
there are many situations where you can't be an expert at. So
democracy is bound to fail?
Well no. Not exactly. I don't think that the double meanings get in
our ways all of the times. Actually it's very handy not to define
every meaning every time. Most of the time we just get the point.
Our intuition leads the way to understand each other.
And democracy at its roots, well is something about the individual
thought. But all the leafs are just plain syndicated thoughts. We
have a discussion and there the definitions come out of the stone
carving itself into our mind and we can make an informed decision.
So if you are "correcting" your friend about the right meaning, well
it is wrong if you are not having a scientific talk or something. In
day to day life the source of scientific knowledge things are
changing. And if a word changes its meaning, well than you can inform
yourself about the difference. Your thought is important, too. But I
personally don't use omnibus for the bus. And bus is just plain
wrong. We are just exchanging messages in our conversations. There
is no rule of the imperative.
And then there are syntax and semantics. Everything you do has a
syntax. Everything you intended is just semantics. The black jeans,
the red dress, there is always an intention, you can just
communicate. If you use words in a certain way, you tell me something
about yourself. And this is what all this correction is about. You
are talking at another level the meta-level to identify yourself as
one of the creatures -- the writers of our language. Or if you
correct because of the origin you are a preserver. It is all about
your role in society and not the imperative of some theory. If at all
there is no theory for the jazz, because then it wouldn't be the
jazz.
O. K., I go and crap my coffee.
Subscribe to:
Posts (Atom)
