# Moving from .Net/Java to Rails

**URL:** <https://www.ruby-forum.com/t/moving-from-net-java-to-rails/86964>\
**Category:** Rails\
**Created:** [February 27, 2007, 7:03am UTC](https://www.ruby-forum.com/t/moving-from-net-java-to-rails/86964 "2007-02-27T07:03:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [February 27, 2007, 7:03am UTC](https://www.ruby-forum.com/t/moving-from-net-java-to-rails/86964/1 "2007-02-27T07:03:12Z")

</div>

Hello,

First let me thank you for your willingness to aid me in my efforts to  
use Ruby (on Rails) in our company to replace existing and fureture  
planned development in .Net and Java.

I have been working on an appication for a couple of years that has been  
written in .Net using C#, but due to a short list of reasons we are  
seriously thinking about re-writing our web application in Rails – or  
at least I am.

While we are evaluating our various options another well experienced  
Java developer is pushing the use of Spring and Hybernate and I am  
advocating the use of Rails. Two out of the three engineers – including  
myself – have experience with rails but have not built large web  
applications as of yet and need some more information about how we will  
approach a couple of our unique problems with Ruby.

So here is one of the big issues that we are facing and I wondered if  
any experts out there could give me some advice on ways we can handle it  
and other more computation intensive operations using the rails stack.

We have 2.7 million geographic destinations in our application that are  
currently stored in a memory cache and are used throughout our  
application heavily. This is used for finding nearby destinations,  
getting destination heigharchy information, etc. We also have a ajax  
auto complete feature that does a prefix match on the cached  
destinations.

Any advice or information about how to handle these types of problems  
would be very helpful.

Thanks so much!

---

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [February 27, 2007, 8:05am UTC](https://www.ruby-forum.com/t/moving-from-net-java-to-rails/86964/2 "2007-02-27T08:05:04Z")

</div>

As far as the problem of storing your 2.7m geographic destinations is  
concerned, the first thing that occurs to me is “RAM disc”. Are you  
able to create a RAM disc, load your data into it, then just read it  
from there as you need it?

For the AJAX auto-complete feature, if you hunt around you’ll find an  
AJAX search example that (from memory) searches for peoples’ names.  
As you type in ‘sam’ (for example) in your search field, the database  
gets hit with e.g. 'SELECT NAME WHERE NAME LIKE ‘s%’, then 'SELECT  
NAME WHERE NAME LIKE ‘sa%’, then 'SELECT NAME WHERE NAME LIKE ‘sam%’.  
Every time the content of your search field changes, it triggers a new  
database search with whatever the content of the field is at that  
point in time.

One example is [http://snippets.dzone.com/posts/show/1691](http://snippets.dzone.com/posts/show/1691), another is  
[Radar – O’Reilly](http://www.onlamp.com/pub/a/onlamp/2005/06/09/rails_ajax.html?page=2)  
(look under the ‘Using Observers’ section, another is  
[Ajax on Rails • The Register](http://www.regdeveloper.co.uk/2007/01/15/ajax_rails_tutorial/)

I’ve built this type of ‘active search’ myself from these examples;  
it’s VERY cool when you get it going, and you can get it going in a  
very short period of time. When I first demo’ed it, people shifted  
180 degrees from “Why should we bother with this Rails stuff?” to “Let  
me at it”.

Regards

Dave M.

---

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [February 27, 2007, 9:13am UTC](https://www.ruby-forum.com/t/moving-from-net-java-to-rails/86964/3 "2007-02-27T09:13:13Z")

</div>

Am 27.02.2007 um 07:03 schrieb Paul H.:

> We have 2.7 million geographic destinations in our application that  
> are  
> currently stored in a memory cache and are used throughout our  
> application heavily. This is used for finding nearby destinations,  
> getting destination heigharchy information, etc. We also have a ajax  
> auto complete feature that does a prefix match on the cached  
> destinations.
> 
> Any advice or information about how to handle these types of problems  
> would be very helpful.

Some pointers:

If you need a memory cache, have a look at [http://www.danga.com/](http://www.danga.com/)  
memcached/  
Have a look at [http://dev.robotcoop.com/Libraries/](http://dev.robotcoop.com/Libraries/) for plugins and libs.

Rails also has great caching features built-in:

> **[ActionController::Caching](https://api.rubyonrails.org/classes/ActionController/Caching.html)**
>
> Caching is a cheap way of speeding up slow applications by keeping the result of calculations, renderings, and database calls around for subsequent requests.

Rails includes support for the [script.aculo.us](http://script.aculo.us) autocompleter–  
basically, it’s two lines of code and you’re there. Of course you can  
customize, too.  
Demos and example code:  
[http://demo.script.aculo.us/ajax/autocompleter](http://demo.script.aculo.us/ajax/autocompleter)  
[http://demo.script.aculo.us/ajax/autocompleter\_customized](http://demo.script.aculo.us/ajax/autocompleter_customized)

Best,  
Thomas

---

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [February 27, 2007, 10:15am UTC](https://www.ruby-forum.com/t/moving-from-net-java-to-rails/86964/4 "2007-02-27T10:15:18Z")

</div>

On 2/27/07, Paul H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> at least I am.  
> and other more computation intensive operations using the rails stack.  
> Ruby really isn’t the best language for computation intensive work. Of  
> course you could still do the front end in rails, just hand off the  
> heavy lifting to a Java powered web service.

> We have 2.7 million geographic destinations in our application that are  
> currently stored in a memory cache and are used throughout our  
> application heavily. This is used for finding nearby destinations,  
> getting destination heigharchy information, etc. We also have a ajax  
> auto complete feature that does a prefix match on the cached  
> destinations.

Rolling your own GIS system? Any reason why you can’t use e.g. PostGIS?

Isak
