SL:s nya priser

Stockholm-Nynäshamn Tur och Retur: 150 kr Månadskort: 1000 kr Dags för revolution snart?

AVL Tree in Python

Here is an AVL tree implemented in Python! Note that it is supposed to be "beautiful" and easy to read and not efficient, that is why both balance() and height() are recursive. I learnt the algorithm from C++ an Introduction to Data Structures which is an excellent book that I recommend. I hope this snippet is useful to someone:
# -*- coding: utf-8 -*- class Node: def __init__(self, data): self.data = data self.set_childs(None, None) def set_childs(self, left, right): self.left = left self.right = right def balance(self): lheight = 0 if self.left: lheight = self.left.height() rheight = 0 if self.right: rheight = self.right.height() return lheight - rheight def height(self): lheight = 0 if self.left: lheight = self.left.height() rheight = 0 if self.right: rheight = self.right.height() return 1 + max(lheight, rheight) def rotate_left(self): self.data, self.right.data = self.right.data, self.data old_left = self.left self.set_childs(self.right, self.right.right) self.left.set_childs(old_left, self.left.left) def rotate_right(self): self.data, self.left.data = self.left.data, self.data old_right = self.right self.set_childs(self.left.left, self.left) self.right.set_childs(self.right.right, old_right) def rotate_left_right(self): self.left.rotate_left() self.rotate_right() def rotate_right_left(self): self.right.rotate_right() self.rotate_left() def do_balance(self): bal = self.balance() if bal > 1: if self.left.balance() > 0: self.rotate_right() else: self.rotate_left_right() elif bal < -1: if self.right.balance() < 0: self.rotate_left() else: self.rotate_right_left() def insert(self, data): if data <= self.data: if not self.left: self.left = Node(data) else: self.left.insert(data) else: if not self.right: self.right = Node(data) else: self.right.insert(data) self.do_balance() def print_tree(self, indent = 0): print " " * indent + str(self.data) if self.left: self.left.print_tree(indent + 2) if self.right: self.right.print_tree(indent + 2) if __name__ == "__main__": tree = Node(5) tree.insert(7) tree.insert(9) tree.print_tree()
I just had to update this so that it would use COLORS!

How to checkout Compiz

This is the command to check out Compiz: git-clone git://anongit.freedesktop.org/git/xorg/app/compiz

ACLs - or Where Windows Beat Linux

Windows have had them for years and just now are Linux distributions about to aquire them. Access Control Lists (ACLs) are necessary in situations where you demand more fine-grained access control than what the old Unix owner, group and world permission bits provide. If you need them, odds are you need them because you have a Samba file server. In this article, I will explain how you setup ACLs for Samba shares running on Gentoo. Also consult this howto for how to get the ACLs working. If you haven't done it already lately, start by syncing yourself: # emerge sync

The States Historical Roots

This is the second installement of my article series about Wikipedia's Ideological Bias. In this article I will deal with how Wikipedia represents the State of Israel's historical roots.

Wikipedia's ideological bias

This is post I've been wanting to do for a long time, but I've never had the time nor the or urge. The idea is to go through half a dozen Wikipedia articles and show with quotes exactly how Wikipedia's bias manifests itself. The articles will mostly be related to the Palestine Question because that is one of the few topics I would dare to call myself an expert in. However, an expert in some other political topic area certainly could make a similar study as mine and would come to a similar result. Purpouse The purpouse if my study is to try and prove that Wikipedia is more unreliable and more ideologically slanted than other major sources of general information. In this first article, I will exhaustingly deal with all evidence of bias in the Wikipedia article Israel. Is Israel a democracy? The second sentence in the article reads
It [Israel] is a parliamentary democracy and the world's only Jewish state.
It is undisputable that Israel has a parliamentary system. It is not undisputable that Israel is a democracy. Many states had and have parliamentary systems such as USA, Russia, DDR, Belarus, Cuba etc. But not all states that have parliamentary systems are democracies. Let's recall Wikipedia's Neutral Point of View policy for a moment. The policys purpouse is to prevent articles from becoming biased.
all articles must be written without bias, representing views fairly ...
Conveniently enough, the policy also defines the word bias.
A bias is a prejudice in a general or specific sense, usually in the sense of having a predilection for one particular point of view or ideology.
Is the statement that Israel is a parliamentary democracy written without bias? No it isn't, because that statement doesn't represent all views fairly. On the opposite, the blank assertion, IS A democracy, invalidates the opinion of everyone who does NOT think Isreal is a democracy. This clearly shows a "predilection for one particular point of view." Scouring the net, it is not hard to find examples of people and organisations that disagrees with Wikipedia:
If what we see in Israel is indeed democracy, then what does fascism look like? ... That the Jewish nature of the state is inimical to democracy as defined by every dictionary in the world matters not, one supposes. Green Left Weekly, Tim Wise, 2002, "Why Israel is not a democracy"
De-facto, then, Israel is not a democracy. One-third of the demos does not enjoy a series of basic rights which make up the pillars of liberal democracies. Dissident Voice, Neve Gordon, 2004, "There's No Democracy Like No Democracy"
the State of Israel is not a democracy due to the application of a Jewish ideology directed against all non - Jews and those Jews who oppose this ideology.Pluto Press, Israel Shahak, 2002, "Jewish History, Jewish Religion: The Weight of Three Thousand Years," p.3
Israel is not a democracy. It is the last racist and oppressive regime on Earth.Al-Jazeerah, Dr. Hassan A. El-Najjar, 2002, Editorial: "Israeli and Palestinian viewpoints of the conflict"
Ones gut reaction may or may not be to think "Oh! But ofcourse he doesn't call Israel a democracy, he is an Arab!" Indeed, many Arabs do not like Israel, but that doesn't mean that Wikipedia should ignore their point of view. According to Wikipedia's own Neutral Point of View policy, Dr. Hassan A. El-Najjar's editorial in Al-Jazeerah should be given just as much weight as if it had appeared in Washington Post.
Israel is not a democracy; it is an Apartheid Garrison-State, a modern-day Sparta. Media Monitors Network, Michael Lopez-Calderon, 2001, "Israeli Democracy: A Promise As Yet Fulfilled"
The aim of the tour is to break the myth that Israel is a democracy. We are here to tell you that Israel is NOT a democracyNew Jersey Solidarity, 2002, Baladna in Aramica
Ben Gurion University political geographer Oren Yiftachel has rightly noted that such a form of government is an "ethnocracy" rather than a democracy. Minaret of Freedom Institute, I. Dean Ahmad, Ph.D, 2001, "The Real Reason to Oppose Israel
As to the Israeli occupation of the West Bank and Gaza, there is an additional factor. The so-called "Palestinian autonomous areas" are bantustans. These are restricted entities within the power structure of the Israeli apartheid system. Nelson Mandela, 2001, "Memo on Palestine"
The picture emerging from the various indicators shows that Israel is mainly a formal democracy that has not yet acquired the characteristics of a substantive democracy. The Israeli Democracy Institute, 2003, "The State of the Israeli Democracy"
These quotes should make it painfully obvious that a large number of sources does not belive Israel is a democracy. Wikipedia therefore misrepresents the debate when it asserts that Israel is a democracy. Note that I have convieniently avoided to argue whether or not Israel is a democracy. For arguments why many thinks Israel is a not a democracy, see the linked to articles. What other sources say MSN Encarta writes that Israel is a multiparty parliamentary republic and in the introduction states that Israel (country), country in southwestern Asia, formed in 1948 as a Jewish state in the historic region of Palestine. Nowhere does encarta write that Israel is a democracy. Britannica writes that [Isreal is a] country in the Middle East, located at the eastern end of the Mediterranean Sea.. I'd claim that these two encyclopedias are more accurate than Wikipedia.

Bloggarkiv