Lukas Z's Blog

Idea: A Kickstarter.com for Open Source Software

There’s software I’d like to have written. For example, a port of the Zenburn colorscheme [1] for Octopress. Or a real time map-matching algorithm in Ruby.[2] Or an up to date guide on securing a Linux webserver. And many things more.

I could of course sit down and tackle these problems one by one myself. But I’d run out of time. After all I have work for clients, my personal projects and everything that makes up my private life. So can’t others write it?

The open source software world is full of great things. Not just nice-to-have gimmicks, but truly essential software that often generates great value for startups and established companies. The days of Oracle and Microsoft licenses for libraries and developer tools are over. At least in the Web and mobile application world. [3]

But how much more could be developed and released for free if there was a way for open source devs to make a living from their contributions?

Sure, some do. An open source database can be financed by selling premium services such as hosting, teaching and tech-support. But many things, some small, but still significant, are made by individuals in their free time.

And then there’s Kickstarter.com which is spearheading a paradigm shift in how projects of all sizes can be financed online. Wouldn’t it be cool to have a site like this exclusively for open source software and related things? [4]

Let’s imagine how a site like this could work.

First, people could post requests of things they want to have developed. For example: “A streaming-webradio library written in Objective-C for use with iOS 6”.

Other people (and companies) could now vote to either express “Yes, I/we need this, too.” or they could agree it’s a worthwhile pursuit and say “Yes, and I am willing to pay 50USD to a developer who writes the software.”

At the same time developers could write responses like: “I can do this. It will take me one month and I want to be paid X dollars for it. I will develop it in this fashion: […insert implementation details here…]”

The idea is to not start a website where the cheapest developer wins, but rather someone who can layout his implementation idea and, possibly, back it up with references, such as his Github repository.

The users can then select which developer should be awarded the job. [5] After a developer is selected, a kickstarter-esque funding round begins. If the amount of Dollars is reached, the money is charged and put into escrow.

The money should be given to the developer in parts, for example as a weekly salary. Meanwhile others should be able to review his work. (And even join in to help him or her.)

If the project looks like it’s a failure it can be stopped, and the remaining funds can be transferred back to the backers. If it succeeds, the last payment goes to the developer.

The software (finished or not) is then released under an Open Source license.

I don’t know.. Perhaps this is a silly idea for many reasons I haven’t thought of. But I think it would be neat thing to have if it worked. Companies would of course benefit as well, and they would have the chance to help finance projects directly and get things that mean profit for their business in return.

Footnotes:

[1] Zenburn colorscheme

[2] This is something I work on for a side-project. The link is to my question on gis.stackexchange.com

[3] Okay, I guess you still need vendor specific libraries, if you develop for any phone platform. I just wanted to make a point that Open Source software changed where we get our tools and libraries from.

[4] Kickstarter.com - There might be many others. I should take some time to research similar sites..

[5] Instead of chosing an individual developer a team could be selected, as well. This team could even change in the future and money to individuals is given proportinately to their involvement.

Resume Scp Transfers

A quick tip that just worked beautifully on a 90GB file for me: It’s possible to continue scp transfers with rsync.

rsync --partial --progress --rsh=ssh user@host:remote_file local_file

taken from here. (Thanks!)

My Second Visit to the Apple Store

Replacement iPhone

There was a scratch on the glass that covers the lens of my iPhone. Once I knew it is there it became very annoying, because I noticed it on every photo I took. And since one of the benefits of having an iPhone is the excellent camera, (Excellent for a phone, anyway.) I felt like I’m not getting all the value for the money I’ve spent anymore.

So I went to the App Store again, this time in the early afternoon, and unlike the first time [1] it wasn’t as crowded. I got a service appointment within 30 minutes, and sure enough, when I returned an Apple store employee was with me on time.

Even though the scratch on the glass could have been caused by my own clumsiness (and maybe it was), I was given a brand new replacement phone. For free. I was told that this is was a case for the 2-year warranty.

He asked me if I have a backup of my phone. I told him I had synced the phone that morning. So he wiped my old one clean using the Reset-feature and told me to plug the new one into iTunes at home. I did and about 20 minutes later I had a phone that had the contents of my old phone, including all apps and configurations (except the internet-settings for my cell-provider).

You can bash Apple all you want, but everything they do is smooth. Their hardware is good, the software is good and their service is good. Why should I want to buy a competitor’s phone next time, provided Apple stays the way it is? I don’t see a reason to.

P.S.: There’s been some talk about Apple losing it’s edge since Steve Jobs died. I don’t think so. Check out this article [2]. They make more money with Macs, which are just a small part of their revenue, than the entire PC industry combined.

Links:

  • [1] My First Visit to the Apple Store
  • [2] Mac Makes More Profit Than the Entire PC Industry

Javascript Popup Windows With Rails

Javascript popups still have their uses. Here is a tiny snippet that one can use to create Javascript popup-windows in a Ruby on Rails application in an elegant fashion.

In your application.js (or whatever .js-file you prefer) include this:

$('a[data-popup]').live('click', function(e) { 
  window.open( $(this).attr('href'), "Popup", "height=600, width=600" ); 
  e.preventDefault(); 
});

Then, in your views add the data-popup-attribute to the link_to-helper:

<%= link_to( 'Open Popup-Window', popup_window_path, 'data-popup' => true ) %>

This is basically taken from [here](http://stackoverflow.com/a/8828841 “”). I have just added two extra parameters to window.open().

The Gist of GIS With MySQL and Ruby on Rails

I am currently working on a small prototype application that requires my rails app to store and process geospatial information. Basically, I am storing and querying longitude/latitude coordinates.

I have been working on projects that had similar use-cases before, but when I joined everything was set up already. Also, usually it was PostgreSQL with PostGIS. This time though, I had to do it myself and with MySQL.

So, since other people might have the same idea, I figured I’d put a few code snippets here so you can get started quicker.

First, here’s my Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.11' # you should update this to 3.2.13 now! ;)

gem 'mysql2'
gem 'spatial_adapter', :git => "https://github.com/descentintomael/spatial_adapter.git"
gem 'geokit-rails3'

# ... some other gems here

This is how a migration might look like (I don’t think you still need the ENGINE=MyISAM line with a current MySQL version):

class CreatePoints < ActiveRecord::Migration
  def change
    create_table(:points, :options => 'ENGINE=MyISAM') do |t|
      t.string :name
      t.column :lat, :decimal, :precision => 15, :scale => 10
      t.column :lon, :decimal, :precision => 15, :scale => 10
      t.timestamps
    end
  end
end

I also added indexes on both decimal-fields.

And here is a bit from my model including two simple queries.

class Point < ActiveRecord::Base
  attr_accessible :lat, :lon, :name

  acts_as_mappable :default_units => :miles,
                   :default_formula => :sphere,
                   :distance_field_name => :distance,
                   :lat_column_name => :lat,
                   :lng_column_name => :lon


  def self.nearest_points( lat, lon )
                Point.within( 10, :origin => [lat, lon] ).order( "distance asc" )
  end

  def self.at_point?( lat, lon )
                Point.within( 0.02, :origin => [lat, lon] ).order( "distance asc" ).first
  end

  # ... etc.
end

Check out the geokit-rails3 README on Github for some examples.

I hope I just saved someone an hour or so of googling.

sSMTP on an Ubuntu Server

Usually when I decide to “quickly set up something on a server” it takes much longer than anticipated. Not so with sSMTP.

Basically it’s a simpler way to send emails from the the commandline. In my case with Gmail. Check out this article on how to set it up. I have also combined it with Logwatch and Fail2Ban and it worked immediately.

In the case of Fail2Ban just one extra line in the config-file was needed:

mta = ssmtp

All of this was inspired by this post (via Hacker News).

Shutterbug

Just a picture I took a few weeks ago in Hamburg. This was taken with my phone. It shows a bit of the harbor on a cold January morning. The light was great. There is ice on the water.

Picture of Hamburg harbor

Open the image in a new window to see the picture in high resolution.

Quick Tip: Suppress Output in Rails Console and Irb

Let’s say you have a collection with 10.000 records in your database and you want to put them all in a large array for some reason. With Rails, you can write something like this:

records = Thing.all

Now you can go get yourself a coffee, because the content of all your records will be output to the console window and it will do so for a while.

Here’s the quick tip: If you want to suppress the output, simply do something like this:

records = Thing.all; 0

Problem solved. Easy, but I didn’t think of it immediately..