Closures and Bindings in Groovy

30. December, 2011

Mark Menard blogged about a hidden gem in Groovy which might be useful when you use closures a lot: Binding properties to a closure after the closure was created.

Remember, it’s simple to bind properties to a closure when those properties exist before the closure is created: Just define them. But how could you create a library of closures for user to consume?

def c = {
	println a // a isn't know here
}

def a = "Hello"

def binding = new Binding ()
binding.setVariable ("a", a)

c.setBinding (binding)
c.call()

As you can see, the property a isn’t known at the time the closure is defined. The binding allows to “inject” it later.

Groovy!


New Years Resolution: Stop being so agreeable!

30. December, 2011

How quick are you to say “sure, we can do that”?

Here are a couple of reasons to reconsider your attitude: Stop being so agreeable! by Erick Erickson.


Building BIRT with Tycho

27. December, 2011

If you want to see BIRT built with Tycho, vote for this bug: [Build] Migrate build to Tycho


So Help me Jobs…

26. December, 2011

One day, Apple might go one step further and start to shape their customers to their liking. They know best, right? Watch this.

“I have nothing to hide.” “Then why do you have curtains?


Open Data ala Google

21. December, 2011

Some concepts are easier to understand when you see a graph. With HTML5, a lot of data and a bit of time, you can build a system that can visualize things like “live span over number of children” or the sources of energy over time. Interesting that nuclear power, renewable energy and energy from crude oil is about the same  level today.

This view seems to indicate that the GDP of a country starts to kick off as soon as each family has two or fewer children. But maybe it just shows that after financial constructs like derivatives and bonds allow to accumulate enormous wealth in a short time. “Correlation does not imply causation


64K on Stackoverflow.com

12. December, 2011
Image representing Stack Overflow as depicted ...

Q&A for professional and enthusiast programmers

Time for a little celebration: My reputation on Stackoverflow.com no longer fits into 16 bits. Yay ^_^

If you’ve been living under a rock: SO is the Q&A site for software developers. If you write software but don’t have an account there is like being a rock star who refuses to perform before an audience 😉

Stackexchange has now 74 sites for many topics: Photography, playing games or writing them, role playing, Unix/Linux, Ubuntu, writing, physics, astronomy, mathematics, English/German/Japanese/French/Spanish language, (La-)TeX, cooking, home improvement, SciFi and Fantasy, parenting, economics, and many more plus more than 450 proposed sites on Area 51.


Making openSUSE 11.4 Work on HP ProBook 5320m

11. December, 2011

If you have an ugly flickering screen when booting openSUSE 11.4 on a HP ProBook 5320m, then do this:

  1. You’ll need at least the package “xorg-x11-proto-devel” to build the driver (zypper install xorg-x11-proto-devel)
  2.  Download a working Intel graphics driver: xf86-video-intel-2.15.0.tar.bz2 (yes, there are other versions there as well and no, they don’t work)
  3. Unpack the archive
  4. cd xf86-video-intel-2.15.0
  5. Configure it: ./configure --prefix=/usr --libdir=/usr/lib64
  6. make
  7. as root: make install
  8. as root: Edit “/boot/grub/menu.lst” Add “nomodeset” to ever line which starts with “kernel”  and which doesn’t already have it
  9. Reboot.

Note: Do this remotely from a second PC – your eyes will be thankful. ssh and wget are your friends.


Meeting Cory Doctorow in Zurich

7. December, 2011

By pure chance, I learned yesterday that Cory Doctorow is in Zurich for a talk about “The Politics of Copyright and the New Cultural Economy” – a topic that I’m very interested in. Also, since I write like him, I of course had to attend 😉 (see for yourself: Little Brother by him and Haul by me). The event was organised by Digitale Allmend.

Cory introduced his three laws:

  1. Anytime someone puts a lock on something that belongs to you and doesn’t give you the key, the lock is not there for your benefit.
  2. Fame doesn’t guarantee fortune, but no one gets rich from being unknown.
  3. Information doesn’t want to be free, people do.

(source)

In his talk, he mentioned the sequence which art takes from the creator to the audience: Artist -> investor -> DRM provider -> audience. The interesting part is that the DRM provider controls the process and how much money goes where – despite the fact that they are most remote from the source. Think Apple: Apple controls how much money they get from products sold via iTunes plus they control what gets sold at all. There was a person in the audience who wrote a little unicorn app that was rejected by Apple for “not being funny enough.”

In a nutshell, Apple controls how much money the creators get by granting or denying access to their marketplace plus they control the tax. If you sell eBooks via Amazon, your book is “protected” by DRM even if you don’t want that. As a creator, the copyright gives me extensive rights over my work but that power is taken away from me from people who are not creative at all and for dubious reasons.

That’s like selling books that you can only put in certain shelves. No reader would accept that you can put Amazon books only on IKEA shelves. It also creates in-locking for creators. No consumer is going to buy a different device if you switch the DRM provider. Which means that if you buy eBooks by Amazon, you’ll never buy them from anyone else – simply because that would mean to have to manage two libraries which you can’t mix. If you produce a TV series, there is no way to switch the vendor between episode 7 and 8 – viewers would go ballistic! If you buy from Amazon and Apple, there is no way to see all your books at the same time. See Cory’s first law.

What makes the current DRM-affine laws so insidious is that they make tools illegal that can potentially be used to circumvent DRM. Since that works so well, DRM providers (by using pawns like the MPAA and the RIAA) tries to broaden their grip on all of us by doing the same on the Internet. If SOPA is turned into law in a few days (and it probably will even though everyone with half a brain is strongly opposed to it), any tool that could be used to circumvent the SOPA censorship is illegal.

That would include “hacker” tools like Firefox, Internet Explorer, Chrome, Safari and any other browser with a location bar. Because all of them allow to type in an IP address in the location bar thus bypassing the DNS filtering that SOPA requires.

Also this blog will be shut down because I write about copyright and that might mean that I potentially could add a link to a “pirate site” in one of my blog posts. At the same time, my PayPal account will be closed – if it wasn’t closed long before that because PayPal will want to close it proactively to prevent them being sued for supporting criminal activities. I’ll know that this has happened when I can’t access my blog/PayPal account anymore – there is no pre-warning, no legal counsel, no way to prevent this from happening. Any big company in the US doesn’t like what I write, I’m done for. Does that sound more like “justice” or more like “censorship” to you?

In the US, two students were sued by the RIAA for developing a search engine for campus LANs because the same search engine could be used to find media files in the LAN, too. Since developing a new Google isn’t illegal, the RIAA tried to blackmail them into stopping. They were pretty sure that they’d find illegal files in the computers of the two students. How did they know? The students were male, 17 and had access to the Internet.

See all this in the light of a prediction that Cory made: Copying bits is only ever going to become more simple.

Think of it: Reading a book on your kindle means copying bits many, many times. First, they are copied from Amazon’s storage into the RAM of some server. Then into various CPU caches, CPU registers, buffers of network drivers, hardware registers of Ethernet chips, switches, routers, mobile phone access points, into the memory of your Kindle. As you open the book, the bits are copied, decoded (= copied many times + manipulated with complex mathematics), copied again into CPU caches and registers, into the frame buffer of a display device.

Between buying a book at Amazon and reading it, the book has been copied several hundred times. And every time you read it, at least four new copies are made. True, most of those copies are quickly deleted but they are made nonetheless.

On top of that, everything that we will do tomorrow will require the Internet. Therefore, the “three strikes” idea, as alluring it might seem, has the potential to destroy a human life. Research shows that having an Internet connection substantially improves the situation of poor families (TODO I’ll post a link as soon as I find one). Of course, anyone with enough money could cut them off any time they like just by suggesting that one of them might be a “pirate” – no proof necessary with the new laws. What is worth more? A human life or the profits of a DRM provider?

Cory brought a great example to drive the point home: Most successful technologies are both simple and general purpose. Think of a wheel. Imagine someone comes along and says: “Well, I like the idea but some villain could attach the wheels to a car and drive away from a crime. Can’t you make a wheel which prevents that?”

No one would take this guy seriously.

Then, we have the PC. It’s also general purpose but at the same time, it’s complex. So it seems like you could create a PC which stops you when you do something naughty. And it’s true. You can try that but as always, there is a price to pay. If want to get an idea of this price, look at China, Yemen or Nazi Germany. It’s always the same psychological pattern.

Human catastrophes started with the urge to “protect your own home country.” As Philip Zimbardo showed in his great book “The Lucifer Effect: Understanding How Good People Turn Evil“, all evil starts with someone trying desperately to do good without realizing when they start to do harm. They start with pressure and when that doesn’t work (and it won’t), they try to increase the pressure. Eventually, torture and death seem OK.

The people behind SOPA and similar efforts just want our best. At the same time, they are blind to the damage they cause. On top of that, there are people involved who aren’t responsible for the well being of the general public. Their main concern is (as per their work contract) to make as much profit as possible. Which makes sense for them and their investors.

But not for the 99%.


One Day Left To Buy Darwinia

5. December, 2011

There is a little strategic gem to buy at Humble Introversion Bundle: Darwinia. Hurry up, there are only 24 hours left … until you have to buy the game elsewhere … where you can’t set the price.

The goal of the game is to help little 2D people (the Darwinians) recapture their artificial world after a nasty virus infection. It’s not too easy and not too hard, the graphics is simple, the controls are easy to master.

I also tried Uplink (same producer) but the game is a little bit too text-heavy to blast off some steam after work.


Forcing SDL to Use a Certain Window Size

4. December, 2011

SDL doesn’t play well with a multi-monitor setup: Either the game window is split over the two displays or one display is set to a different height than the other (making part of the surface unreachable with the mouse) or your desktop is messed up when you exit the full screen mode.

I’ve written a patch that allows you to force SDL to use a certain window size/resolution by setting the environment variable SDL_VIDEO_SIZE to “widthxheight” before starting the game: https://gist.github.com/1429985

Example (bash):

export SDL_VIDEO_SIZE=1024×768

Works best when running the game in a window.


%d bloggers like this: