Keeping it Small and Simple

2008.04.06

Stuff one-legged, cat-owning, 33-year-old she-males with two kids like

Filed under: Rants — Tags: , — Lorenzo E. Danielsson @ 19:28

Is it just me or are there too many Stuff X people like blogs popping up? It was (maybe) funny for a while, but I think its time to move on. How about something original, for a change?

It can’t be all that difficult to come up with a new concept that is dumb enough to attract loads of people who will do anything as an excuse not to do the things that they are supposed to be doing.

Advertisements

Web Developer add-on for Firefox 3

Filed under: Software — Tags: , , , — Lorenzo E. Danielsson @ 18:53

I finally got around to installing the Web Developer add-on. Last time I checked, which was a long time ago, it wasn’t yet updated for Firefox 3. Today I was browsing through the extensions site and realized that it has been updated.

If you are a web site designer and/or developer, you might want to have a look at the Web Developer add-on. It adds a toolbar that gives you a bunch of web development related functions. One that I find useful, is the ability to highlight elements, like DIVs. I use that to figure out where my (table-less) layouts go wrong.

On the downside, it adds a huge toolbar. I wish there was a key-binding to quickly hide/unhide it (maybe there is one, but I’m not aware of it).

2008.04.05

I don’t cuss nearly enough

Filed under: Humor — Tags: , , , , — Lorenzo E. Danielsson @ 22:03

Thank you Lone Wolf for linking to the Blog Cuss-O-Meter.

The Blog-O-Cuss Meter - Do you cuss a lot in your blog or website?
Created by OnePlusYou

As you can see, I’m fairly fucking family friendly.

Good beginner book for learning Python

Filed under: Python Programming — Tags: , , , , , , , — Lorenzo E. Danielsson @ 21:32

If you are completely new to programming take a look at How to Think Like a Computer Scientist. It seems quite good, and starts at the very beginning. It is also available on-line, so you don’t have to run to the bookstore and fork out $$$.

It teaches Python, which I think is a good beginner language. It also teaches programming in general, and you will find that what you learn will help you later if you want to learn other languages. Many people will tell you a lot about which programming language is the best first programming language. I don’t think it matters much really. What is more important is to learn one language and to learn it well.

Of course, there are a lot of other good resources as well. It’s good to have access to as many as possible. Each one will have its strengths and drawbacks.

Once you have got a good understanding of the basics, I recommend Dive Into Python which is also available in the Debian repositories (aptitude install diveintopython).

A difference between men and women

Filed under: Humor, Sex — Tags: , , , — Lorenzo E. Danielsson @ 20:47

Women have “vagina dialogues” where the openly talk about their vaginas.

We men are different. We engage in “cock dialogues” where we talk to our cocks. “Get up you lazy tool! It’s the first time in months that I can have real sex and you want to sleep!”

Why do I doubt God’s existence?

Filed under: Religion — Tags: , , , — Lorenzo E. Danielsson @ 20:12

*sigh* Here we go again. I am responding to this.

Part 1

We know God exists through the things He has made. “Since the creation of the world, invisible realities, God’s eternal power and divinity have become visible, recognized through the things He has made.” (Rom. 1:20)

Hermeneutics. This just establishes the claimed existence of a god by reference to a book. Give us a method for testing the claimed facts.

Often the reason people reject God’s existence is not based on logic, but on emotion.

Care to back this claim up? I, as I have mentioned in several posts, neither deny nor accept the existence of any god. I do not believe in gods, but I am aware of the impossibility of conclusively proving God’s “non-existence”.

Imagine if we turn the statement around: often people claim that God exists based not on logic, but on emotion. That sounds at least as reasonable as the original statement. I am sure that there are a lot of people on both sides that make a lot of emotional claims.

They do not want to believe in God because this would mean they have to keep His commandments.

Another claim without any support whatsoever. There are many non-religious reasons to follow at least some of those commandments. Laws against killing and stealing, for instance, seem to be pretty universal, even in societies that are not Christian. And of course, the Christian church has historically killed people who have questioned its authority.

St. Augustine says: “He who denies the existence of God, has some reason for wishing that God did not exist.”

This is just a quote from one author, who happens to have been a Christian. The quote confuses the words deny and wish. Asking people who don’t believe what their reasons are would quickly refute this claim.

If there was a Big Bang, who caused it? Every cause has an effect, and there cannot be a limitless number of limited causes. Ultimately there must be an uncaused cause. If we have a line of dominoes and they fall down, something must have moved the first one. God is the uncaused cause, the unmoved mover.

Now here is a really interesting question. Now of course, it is fully possible to be an atheist and not believe in the Big Bang theory, but let’s for a moment pretend that every non-believer also is a believer in Big Bang.

It is an unanswered question what was the original energy that caused everything to happen. That could point to a god, but not necessarily. There could be other explanations, including ones that we haven’t even thought of. And if a god was the original source of energy, does that mean that Christians then accept the Big Bang theory? Because if they don’t there is no need to put this argument forward, since a Big Bang initiated by God is still in opposition to biblical claims.

I could go further and ask why this should point to the existence of the Christian god. Why couldn’t the original energy be Thor? Or Jupiter? Or any other god.

Part II

Here the author lists a few “arguments” for the existence of god.

Argument from Design
This is so stupid I don’t even know where to begin. I can’t speak for all atheists, but I have never met an atheist that claims that everything happens “by accident”. The creation of the universe is normally explained as having happened through a series of physical processes. Hardly an accident, in other words. I’m an agnostic, so I’ll be a bit more careful about proclaiming what actually happened, at least I can see conclusive evidence.

Moreover, this has absolutely no bearing on the very determined building of a car in a factory. The car is built because there is a factory there, there are materials and workers, there is a company that has set up operations in order to produce units of car for a purpose (normally sales).

Argument from Dependency
Even if we accept this it in no way establishes the existence of a god. And even if we choose to use this as an argument, in what way does it establish the existence of the Christian god as opposed to any other god?

Argument from Conscience
Many people deny the existence of absolute moral law. And there are many moral absolutists who deny the existence of god. Utilitarians, for instance, believe in an absolute moral law, but are not necessarily religious (although individual utilitarians could be religious).

Pascal’s Wager
This is pretty the argument that C.S. Lewis’ put forward for believing in God. The problem is that what if you genuinely do not believe? Should you still pretend to believe “just in case”? That doesn’t seem reasonable to me. Of course, the Christian church would still want you to, because they are interested in your money.

The Purpose of Life Argument
This whole argument presupposes that there is a purpose of life. Of course, the author does not present any support for that claim. It may well be that it is valuable for people to think that there is a purpose of life. That does not mean that there actually is one.

An mpd clone in Ruby

Filed under: Ruby Programming, Rubygame — Tags: , , , , , , , — Lorenzo E. Danielsson @ 18:02

I was bored, so I decided to write a clone of my music player of choice, the excellent mpd. I also put together a little client, similar to my favorite mpd client, the highly usable mpc.

These are of course watered-down clones that cannot match the original mpd. I wasn’t so much interested in writing an alternative to mdp as just writing something for the fun of it. Feel free to improve upon it.

You will need to have Rubygame installed on the machine that is running the server. There are alternatives that you could look into, but I happen to know Rubygame so I am using it. It is likely that I will at some point experiment with other libraries.

Server/client communication is done via XML-RPC. This makes everything very simple. Again, if you want to practice, you change to some other method for client/server communication (SOAP, your own protocol, or whatever).

Other things you could do include writing a GUI client (I recommend Tk, but Qt4 is also nice, Gtk less so, but at least its Ruby bindings are decent to work with). Or, if you think everything should run in the browser, why not a web client? Of course, you can also add more features. In that case I recommend looking into what mpd supports and try to implement as much of it as possible.

First the server, rmpd:

  1 #! /usr/bin/ruby
  2
  3 # A music playing daemon written in Ruby.
  4
  5 begin
  6   require rubygame
  7   require xmlrpc/server
  8   require optparse
  9 rescue LoadError => e
 10   msg, lib = e.to_s.split /\s+–\s+/
 11   abort "Unable to find #{lib}, cannot continue."
 12 end
 13
 14 class PlayerService
 15   def initialize(player)
 16     @player = player
 17   end
 18
 19   def add(song)
 20     @player.add song.to_i
 21   end
 22
 23   def lsc
 24     @player.lsc
 25   end
 26
 27   def lsq
 28     @player.lsq
 29   end
 30
 31   def play
 32     @player.play
 33   end
 34
 35   def next
 36     @player.next
 37   end
 38
 39   def stop
 40     @player.stop
 41   end
 42 end
 43
 44 class ControllerService
 45   def initialize(player)
 46     @player = player
 47   end
 48
 49   def shutdown
 50     @player.shutdown
 51   end
 52 end
 53
 54 class Player
 55   def initialize(path, port=8080, addr=*)
 56     @col = []
 57     @queue = []
 58     @current = nil
 59     @control = nil
 60
 61     parsedir(path)
 62
 63     @server = XMLRPC::Server.new port, addr
 64     @server.add_handler "player", PlayerService.new(self)
 65     @server.add_handler "controller", ControllerService.new(self)
 66     @server.set_default_handler do |name, *args|
 67       obj, meth = name.split /\./
 68       "No such command: #{meth}"
 69     end
 70
 71     Rubygame.init
 72     Rubygame::Mixer.open_audio
 73   end
 74
 75   def run
 76     @server.serve
 77   end
 78
 79   def add(song)
 80     @queue << @col[song]
 81     "Added #{song}: #{File.basename(@col[song])}"
 82   end
 83
 84   def lsc
 85     return "Collection is empty." if @col.empty?
 86
 87     str = ""
 88     @col.each_index do |idx|
 89       str += "#{idx.to_s.rjust(3)}: #{File.basename(@col[idx])}\n"
 90     end
 91
 92     return str
 93   end
 94
 95   def lsq
 96     return "Queue is empty." if @queue.empty?
 97
 98     str = ""
 99     @queue.each_index do |idx|
100       str += "#{idx.to_s.rjust(3)}: #{File.basename(@queue[idx])}\n"
101     end
102
103     return str
104   end
105
106   def play
107     return "Already playing" if !@current.nil? && @current.playing?
108     return "Queue is empty" if @queue.empty?
109
110     begin
111       song = @queue.shift
112       @current = Rubygame::Mixer::Music.load_audio song
113       @current.play
114       control
115       "Playing #{File.basename(song)}"
116     rescue 
117       "Something went wrong"
118     end
119   end
120
121   def next
122     return "Not playing." if @current.nil? || !@current.playing?
123     @control.exit unless @control.nil?
124     @current.stop
125     sleep 1 while @current.playing?
126     play
127   end
128
129   def stop
130     return "Not playing." if @current.nil? || !@current.playing?
131
132     @control.exit unless @control.nil?
133     @current.stop
134     "Stopped."
135   end
136
137   def control
138     @control = Thread.new {
139       sleep 1 while @current.playing?
140       play unless @queue.empty?
141     }
142
143     @control.run
144   end
145
146   def shutdown
147     @server.shutdown
148     Rubygame::Mixer.close_audio
149     Rubygame.quit
150     "Shutting down server."
151   end
152
153   def parsedir(path)
154     Dir.new(path).each do |file|
155       next if file =~ /^\./
156
157       if File.directory? "#{path}/#{file}"
158         parsedir "#{path}/#{file}"
159       else
160         @col << "#{path}/#{file}"
161       end
162     end
163   end
164 end
165
166 options = {
167   :addr => 127.0.0.1,
168   :port => 8080,
169   :dir => "#{ENV[HOME]}/music"    
170 }
171
172 begin
173   OptionParser.new do |opts|
174     opts.banner = "usage: #{$0} [options]"
175
176     opts.on("-a", "–address=ADDR", String, "Address to listen on.") do |addr|
177       options[:addr] = addr
178     end
179
180     opts.on("-p", "–port=PORT", Integer, "Port to listen on.") do |port|
181       options[:port] = port
182     end
183
184     opts.on("-d", "–dir=DIR", String, "Collection directory.") do |dir|
185       options[:dir] = dir
186     end
187   end.parse!
188 rescue
189   abort "Command line foo!"
190 end
191
192 mpd = Player.new options[:dir], options[:port], options[:addr]
193 mpd.run

Here is the client, rmpc:

 1 #! /usr/bin/ruby
 2
 3 # A client for rmpd.
 4
 5 require xmlrpc/client
 6 require optparse
 7
 8 options = {
 9   :port => 8080,
10   :addr => "127.0.0.1"
11 }
12
13 begin
14   OptionParser.new do |opts|
15     opts.banner = "usage: #{$0} [options] command"
16
17     opts.on("-a", "–address=ADDR", String, "Address of server") do |addr|
18       options[:addr] = addr
19     end
20
21     opts.on("-p", "–port=PORT", Integer, "Port of server") do |port|
22       options[:port] = port
23     end
24   end.parse!
25 rescue
26   abort "Command line foo!"
27 end
28
29 abort "No command." if ARGV.empty?
30
31 begin
32   server = XMLRPC::Client.new options[:addr], "/RPC2", options[:port]
33 rescue
34   abort "No contact with server."
35 end
36
37 player = server.proxy "player"
38 control = server.proxy "controller"
39
40 command = ARGV.shift
41 if command == shutdown
42   puts control.shutdown
43 else
44   puts player.send(command, *ARGV)
45 end

What I’d like to see on the new WP dashboard

Filed under: Wordpress — Tags: , — Lorenzo E. Danielsson @ 16:34

After having used the new WordPress dashboard for a few hours, the thing that sticks out is information overflow. Don’t get me wrong, as I said in my previous post, I mostly like the new dashboard.

But, I wish each block had an expander so that I could expand/contract it. That way, I would have more control over what information I see at any point in time. Further, it would be nice to be able to re-organize the blocks. The summary block that appears at the very top holds the information that I am least directly interested in. I would have loved to position that block at the very bottom instead.

I don’t know far it is possible to customize the WordPress dashboard. I’ve never wanted to do anything like this before. But now, I think it’s time to look into it a little. WordPress (the software) is open source, so it is simple to modify to your own needs, if you are running your own site, or running it locally. But, at WordPress.com, we cannot modify the code so we have to rely on whatever configuration options the UI gives us.

Moreover, I’ve noticed that the new UI leads to more scrolling. Possibly fewer clicks than before, but more scrolling. Having tags and categories beneath the editor on the Write page is beginning to get frustrating. The natural place to have these would be beside the editor, as before.

Interestingly, the Tags and Categories blocks do have the expanders that are missing on the dashboard.

All in all, the new WordPress.com look and feel is probably a step in the right direction with a few quirks that would need to be fixed. With regard to the things that used to be good and have got worse, there is an old saying: if it ain’t broke, don’t fix it.

2008.04.04

WordPress.com upgrade

Filed under: Wordpress — Tags: , , — Lorenzo E. Danielsson @ 22:27

I guess everybody who blogs here will have noticed already. The first thing I noticed was a new dashboard with more information on it. I like it! Then I noticed that the Write Post page has also changed quite a bit.

It all looks nice. It will take a while to get used to some of the changes, but in the long run I think this will allow us to work with WordPress more efficiently (less page clicks for instance).

Currently my pages timeout frequently and I have to reload a few times, but I hope that is just an “upgrade in process”.

An animated history of American empire

Filed under: History — Tags: , , , , , , , — Lorenzo E. Danielsson @ 10:54

Over at TomDispatch you can find this little animated movie based on Howard Zinn’s new cartoon book A People’s History of American Empire. Voiceover by Strider.. uh.. I mean Viggo Mortensen.

« Newer PostsOlder Posts »

Blog at WordPress.com.