Have you ever wondered why your Rails application is so memory hungry when it is not even really trying to fully utilize your CPUs? To saturate your CPUs, you have to have a large number of Thin (or Mongrel or whatever) instances. Why is that? We all know that the Ruby interpreter is unable to utilize more than one CPU (or no more than one CPU at a time in the case of 1.9), but why can't Ruby (or maybe it's Rails?) utilize the processors efficiently? Let's look for an answer to this question.
Recently, I’ve been involved in a project where I used Ruby On Rails to create a WAP site that needed to display certain locations using Google Maps. Given the limited capabilities for the average WAP browsers (mainly the lack of JavaScript), I needed to figure out a way to achieve this.
Lucky for me, Google has Google Static Maps API, which is basically a URL that you put in the src attribute of an img tag. The URL accepts parameters that will define the image you get; the most important parameters are the Longitude/Latitude of the map’s center and the zoom level. The URL looks like the following:
What is a "load average"?
In linux machines, the " top " command is one of the most frequently used commands to get information about your machine performance. It gives you information about your CPU usage, RAM usage and the load average of the machine. The load average represents the average system load over a period of time and in nomal cases it should be under 1.0. You can get the load average by typing "top" or "uptime" in your shell and it will give you 3 numbers which represent the load in the last 1, 5 and 15 minutes. An IDLE CPU will result in 0 load, while a load of 2.5 represents that the cpu was overloaded by 150% in the last minute.
The Hidden Markov Model Toolkit (HTK) is a portable toolkit for building and manipulating hidden Markov models. HTK is primarily used for speech recognition research although it has been used for numerous other applications including research into speech synthesis, character recognition and DNA sequencing. HTK is in use at hundreds of sites worldwide.
Quoted from the HTK website.
HTK is a free/open-source piece of software; it builds on Linux, Solaris, IRIX, HPUX, Mac OS/X, Windows NT, 2000, XP and FreeBSD.
Rmagick is an interface between the Ruby programming language and the ImageMagick and GraphicsMagick image processing library. Earlier on , with ruby version 1.8.5, we used to install rmagick by installing these debian packages (librmagick-ruby and librmagick-ruby1.8) and not with gem install rmagick command, so as to save around 1 hour of compiling the dependencies that rmagick needs. These 2 packages are not valid if you decided to upgrade your Ruby to Ruby enterprise, as you will get errors related to rmagick, especially if you have captcha.
One of the common mistakes developers make when creating layouts is specifying a width of 100% when they need the block element to take the full width of its parent element.
#footer {
width: 100%;
margin: 7px;
padding: 5px;
border: 1px solid #CCC;
}
DZone's Geertjan Wielenga has conducted an interview with eSpace's very own CTO, Muhammad Ali, and our services manager, Ehab El-Badry, on eSpace's technical choices and decisions. Read the interview here.
FCKeditor is one of the most powerful rich text editors out there. However, FCKeditor extension for Radiant lacks a very important feature: enabling the site admin to change the editor's interface language. That feature was a requirement in a project I was working on, so I decided to dive into the extension's code to see what's going on in there, trying to figure out a way to hack that feature in.
Being one of the its admirers, I try to conform to REST almost all the time, thanks to Rails support. One of the problems in following the REST model is the problem of resource naming. In its simplest forms, REST is about mapping each resource to a unique name with a set of conventional urls. The problem appears in a case when you need more than one view for some/all of your application resources (in the same format), or in other words, if some resources need to have colliding names.
One of the most helpful and simple-to-use Rails plugins is simple_localization. It makes the job of localizing a Rails application a lot easier and straight forward; it implements localization through a set of features. One of the most commonly used features is localized ActiveRecord error messages. Its use is for localizing the standard error messages generated upon ActiveRecord validations ("can't be blank", "is too short", ..etc).
Working on a Rails project, after localizing the whole application, everything was working just fine in the development environment. However, when trying it in production environment, the locaized-error-messages feature didn't seem to work properly. Error messages for some (not all) of the models were not translated. To my surprise, those models were exactly those being observed by declared observers.
Now, what seems to be the problem? The problem is that the implementation of localized-error-messages feature is just as simple as follows; it just overrides ActiveRecord::Errors.default_error_messages with the translated version.
One of the common bugs of IE is the box model bug which affects the box model of any HTML block-level element when the page is in quirks mode. In brief, IE includes the padding when calculating the width of the block. Personally, I found this very logical and I don't like to consider it a bug, but since it violates the W3C standards, it is a bug.
One simple approach to avoid this bug is to avoid specifying both width and padding or border for an element. How?
Archive
Latest Comments
- zxdvcs Commented on Reading Arabic in a PuTTY Connection
- zxdvcs Commented on Reading Arabic in a PuTTY Connection
- Ed Hardy Commented on Check Out Our iGoogle Gadgets
- Ed Hardy Commented on Thin, the thin server that can!

