Devise – Demo Event Tool

I'm a developer and I enjoy programming.. :)
One of my play-projects is a tool called Devise. It's build for the demo group "Edge of Panic".
(We've made several releases (see bottom of this page))

I've did 3d coding for Edge of Panic a few years ago (look at the ugly recursive ball scene in the Breakpoint 2010 demo), but the the last two years I'm way to busy with my company to work on the 3d engine (which btw resulted in the development http://edbee.net/).

Though I'm very busy, I've managed to find some spare time to work on Devise.

Devise is used for creating timing events and triggers in the demo. The tool imports both midi-data of the music track and the audio data and visualizes these items. The events can be moved, resized altered etc.
Events can be as simple as on or off, or can contain spline data and in the future it should be possible to write code in the event bars.

The next image shows a screenshot of this tool (written in C++ Qt)

Screen Shot 2013-10-03 at 23.06.36

Last week we had a BBQ which was used to demonstrate the state of the engine. Watch the movie below:
Lights and other events are synced on the music. This syncing is done with the help of the devise tool.

Notice the transparency in combination with deferred lighting. Our engine is improving (great work blackstar!) :)

Some releases we've done:
- Breakpoint 2010 - http://www.youtube.com/watch?v=mkuS1COsHgQ (a quick demo hack build in a few weeks)
- Revision 2012 - http://www.youtube.com/watch?v=vkkftgkw56A (a more mature release)

We've planned to finish out next production on Revision 2014, with some great music from Mr-Z and Davizion

Bundler / Passenger strange deployment Issue

Today I tried to deploy our Ruby on Rails application. Environment: Passenger with Ruby on Rails 1.9.3 (via system-wide-rvm) on FreeBSD. Deployment via a simple capistrano script.

After a successful capistano deploy I get the following error when trying to view it in the browser:

Web application could not be started

Could not find rake-10.1.0 in any of the sources (Bundler::GemNotFound)
  /usr/local/rvm/gems/ruby-1.9.3-p392@generalrails/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize'
  /usr/local/rvm/gems/ruby-1.9.3-p392@generalrails/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `map!'
  /usr/local/rvm/gems/ruby-1.9.3-p392@generalrails/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `materialize'
  /usr/local/rvm/gems/ruby-1.9.3-p392@generalrails/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
  /usr/local/rvm/gems/ruby-1.9.3-p392@generalrails/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in `specs_for'
  /usr/local/rvm/gems/ruby-1.9.3-p392@generalrails/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in `requested_specs'
  /usr/local/rvm/gems/ruby-1.9.3-p392@generalrails/gems/bundler-1.3.5/lib/bundler/environment.rb:18:in `requested_specs'

When I run rake --version in the selected rvm-environment it just exists.
After searching for while I found the following problem:

Passenger gave the following GEM home:

GEM_HOME = /var/usr/local/www/https_www.webpathy.eu/shared/bundle/ruby/1.9.1

When I look in the directory "shared/bundle/ruby" I see everyting is deployed in a directory named: 1.9. The 1.9.1 directory is completely empty!

That's not going to work
WTF!

My quick work-around is the following:

ln -s 1.9 1.9.1

Now it's running again...
Does anybody know why bundler first deploys it all in "bundle/ruby/1.9" and passenger tries to grab it from "bundle/ruby/1.9" ?!?!?

Parallels Deskop 7 slowness

Yes another article about parallels desktop slowness
Since I long ago updated from older parallels version to 7, it seems it has become slower and slower.
When I boot Parallels my Mac grinds to a halt for several minutes.

Last week I tried another solution to cope with problem.
I noticed spotlight was indexing while booting Parallels, of course this isn't a nice situation.

I've read that spotlight makes use of importer-plugins to index the data.
To view the executed importer you can use the following command

mdimport -L

Which results in a big list with:

2013-09-18 10:53:42.292 mdimport[5667:707] Paths: id(501) (
    "/Library/Spotlight/iBooksAuthor.mdimporter",
    "/Library/Spotlight/ParallelsMD.mdimporter",
    "/Library/Spotlight/iWork.mdimporter",
    "/System/Library/Spotlight/Application.mdimporter",
    "/System/Library/Spotlight/Audio.mdimporter",
    ...
    "/System/Library/Spotlight/Automator.mdimporter",
    "/System/Library/Spotlight/SystemPrefs.mdimporter",
    "/System/Library/Spotlight/vCard.mdimporter",
    "/Applications/Xcode.app/Contents/Library/Spotlight/uuid.mdimporter",
    "/Applications/Evernote.app/Contents/Library/Spotlight/EvernoteSpotlightImporter.mdimporter"
)

I noticed a ParallelsMD.mdimporter. WTF, I don't want indexed parallels disks.
Also I read there should be an option in the parallels virtual machine configuration to enable or disable spotlight on a virtual Machine. I couldn't find this option...
Could it be that my Parallels importer is enabled from an older parallels installation and that I cannot disable it anymore?

So I simply removed the importer:

sudo rm /Library/Spotlight/ParallelsMD.mdimporter

Problem solved?
After testing unfortunately no.. The slowness of Parallels remains.
Though it seems my spotlight indexing has improved.
It doesn't take that long anymore.

edbee

Edbee screenshot

Last week I released edbee to Github.
Edbee in the essence is an editor QWidget designed for use with Qt.

edbee logo

Edbee screenshot

Some history

I've started with this editor component in the summer of 2012 as an in house product.
Edbee has been created because I needed a source-code editor for my Qt Application. I'm developing a very specialistic developers tool, which requires some advanced editor handling. Unfortunately my attempts with diverse standard products failed.

QTextEdit didn't fit my needs, because it was to complex at some points (The richtext part) and way to limited at other parts (replacing the document backend).
I've given it a try but it really didn't do what I needed it to do.

Scintilla was a much better attempt, except it gave me problems with editor-synchronisation. The cause for this was a sort of incompatibility Iv'e got with the messaging system that Scintilla uses and the connection-system of Qt. I probably could have solved this (and I've did solved part of it), but it required me to make considerable changes in the Scintilla source code. I really didn't like the idea of maintaining a fork of Scintilla. (Btw. Scintilla is a very nice editor-component used by several products like Scite and Notepad++)

This lead me to think I could write an editor myself, so it would fit my needs. This shouldn't be that hard, just move the cursor and draw some letters (so I thought). Well I was very wrong :)
I really like Sublime Text, it really has really some awesome features, so while writing this editor I just implement one of my favorite features: multi-caret support.
Well this last decision really made the development a much harder, especially the undo part.

When the editor was at a certain level I needed support for syntax highlighting, I've first tried to implement a system like the one that Scintilla uses, because of the simplicity of implementing it. But after realizing that I needed to write a lexer for every language I really freaked out and decided to stick with the Textmate/Sublime grammar files.

But using textmate grammer-files required the inclusion of scopes to identify items in the text. So I build in supporting classes for scopes. To recognize these scopes I needed to run the regular expressions used in the grammar files.
Running these regexps in Qt with QRegExp doesn't work. Really it doesn't I tried it..!! I've included Oniguruma for this (The regexp engine of Textmate, Sublime and Ruby)

Now I was able to identify the scopes in the editor. When I had the scopes It was more then logical to use the theme files of Textmate because these were scope-based.

Why Opensource it?

Well I don't see any real big market for it. To be honestly I don't think the quality of the editor at this moment is at the required level for a commercial product. Also I hope to improve the quality of this product by open sourcing it. Though I'm a bit afraid for the criticism I might get on the written code, I hope that critics and remarks will improve my Qt coding knowledge and the overall quality of the editor component.
Also I really would like to see multi-caret support in many more products!

The Editor App

I've written an editor application for this text-component. The initial purpose was to create a simple application that could be used for playing with the component in a simple setting. The first version was a simple form of irresponsible code to quickly play with the thing. It still has a lot of dirty hacks in it.

The plan I have with this editor is to expand it to a full cross platform scriptable editor-environment.

I've build some binaries and placed the at https://bintray.com/gamecreature/edbee/edbee-app. Be warned though, I still need to figure out all dependencies of these executables (especially the windows version) and need a better way to distribute the editor.

There's still a lot of work todo..
If anybody is interested in helping please drop me an email ( rick, blommersit, nl )* or a tweet!@gamecreature :)
* Replace the comma/spaces with the correct two symbols

Ruby on Rails Json Serialization – To Infinity and beyond!

Wel the title says it all :)

There's a subtile, but very important difference between Ruby on Rails 3 and 4 with json serialization.

Rails 3

(1..10).as_json => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Rails 4

(1..10).as_json => "1..10"

I had a piece of Ruby code that modeled the business rules of the application like this:

 
{
  brackets: [
    { income: 0..19_645,               perc: 37 },
    { income: 19_646..55_991,          perc: 42 },
    { income: 55_992..Float::INFINITY, perc: 52 }
  ]
}

Try serializing this to the browser with to_json in Rails 3 and prepare for a long wait ;)

The workaround I used to this was creating an initalizer "/config/initializer/range_to_json_monkey_patch.rb"

#
# This initializer requires some explanation
# 
# In the ruby version installed (Rails 3.2.13)  the json encoding method works like this:
#   ActiveSupport::JSON::encode(1..10)  => [1,2,3,4,5,6,7,8,9,10]
#
# Doing this with a large range  is not nice!!
#
# Ruby on rails 4.0.0.1 works like this:
#   ActiveSupport::JSON::encode(1..10)  => "1..10"
#
# This initializer modifies the Range#as_json method so it works like rails 4
# this method first checks if this adjustment is required
#
if (1..4).as_json.kind_of?(Array)

  class Range
    def as_json( options=nil )
      self.to_s
    end
  end

end

Now the json-serialization of Ranges will behave like the one in Rails 4.