Ruby Studio Blog

Agile web development and IT solutions

Gitlab Adopted as Internal Development Platform

We’re very excited to announce that we have adopted Gitlab as our internal development, collaboration and repository platform! All our current and future projects have been migrated from github to our dedicated gitlab server and we’ve been extremely pleased with the stability and maturity of the software.

Projects Upgrade: Rails 3.2

We’ve upgraded our current projects to the newly released rails 3.2. The upgrade currently affects rubystudio.net, darvazaogrev.com, vasev.org. Rails 3.2 will be used for all future projects and revamps that are currently in development, and we’re also looking at moving IP.Trac to the 3.x branch.

Project Revamp: vasev.org

Vasev.org has been rewritten as Rails 3.1.1 application, bringing speed and security improvements, usability enhancement and design tweaks.

Auto-resizing Page Elements With Jquery Mobile

If you’ve been using jQuery Mobile from the start or if you’re just beginning to play with it (beta 3 is current at the time of this writing) you might have noticed that in recent versions auto-resizing of page elements does not work for all devices out of the box and this was not the case in earlier versions. The answer is simple, but not well documented (if at all): you need to add the viewport meta tag in your layout:

1
<meta name="viewport" content="width=device-width, initial-scale=1">

Dealing With the “invalid Multibyte Char” Error

If you happen to use non-ASCII characters in a ruby file within your rails app, say a controller, library, database seeds, etc, you might have the invalid multibyte char (US-ASCII) error thrown at you by ruby 1.9.x. This is something you’re bound to experience if you’re developing an app that is localized in a language that utilizes non-ASCII characters and you’re not using the i18n libraries of rails to define your strings. The solution is very easy and feels almost magical:

1
# encoding: utf-8

Put this line of code on top of all scripts that raise the error. Unfortunately there seems to be no way to deal with it on application level with a single entry. It’s Ruby legacy, but perhaps it should be considered as a Rails default for future versions.

Piwik - the In-house Web Analytics Solution

All piblic websites need a way to track their visitors and while Google Analytics remains the de-facto standart for web analytics, in certain cases customers prefer alternatives. There might be several reasons to opt for an alternative, to name but a few:

  • the customer might not trust Google or generally any external service with their web data
  • the customer might want features that are missing from Google analytcis, such as real-time analytics
  • the customer might want a more sophisticated API without quota limits to pull their data

Granted we still use and recommend Google analytics as the primary solution here at Ruby Studio, we looked for possible alternatives in an effort to accomodate these user cases.

For live tracking the popular choice is Woopra, and we still use it on some of our projects on customer request, however it has the downside of loading too much javascript too slowly and recent tests we’ve made indicate that Woopra code takes about as much to load and process as all the rest of our code and assets for a particular page put together. Some tweaks and hacks are possible for performance improvement, but overall it remains too slow and hence not a primary choice for us.

Ideally we would have picked a Ruby based solution, so we considered RailStat, but we decided it’s not yet mature enough for production, its feature set is still somewhat limited and there seems to be no active development. We’ll be keeping an eye on it for the future.

So eventually our choice fell on Piwik. An open source project with rich feature set, slick ajax-y interface, actively developed and maintained, with good market penetration (used on more than 150 000 sites). It also has a simplified, but fully working Live analytics module, allows extensive customization and provides a rich API. Performance seems also quite good, the speed of getting and parsing the tracking javascript seems on par with Google analytics, the impact on the webapp performance is minimal.

So we will be offering Piwik as an option for web analytics to our customers in 3 varieties:

  • as part of our unified analytics service at analytics.rubystudio.net. This service will be used by multiple customers and web projects; user accounts for access and website permissions will be set at per customer basis.
  • as a separate Piwik instance, hosted by us, but not shared with other customers or web sites, and the customer will receive full administration rights for the instance.
  • as a customer-hosted solution. We can install and configure a Piwik instance for our customers on their own servers or at their chosen hosting provider, and in this case the customer retains all the privileges and responsibility of maintaining and hosting the software on their own