NetBeans 6.1 Beta was released last week. Amongst
the many improvements, one of them is the bundled
JRuby 1.1 RC2 and
Rails 2.0.2.
The jMaki
plugin used to work fine with Rails 1.2.3 but need to be updated
because of changed file name extensions for the default generated
views (".rhtml.erb" instead of ".rhtml"). With this release of
NetBeans, jMaki plugin has been updated to work in this
configuration as well.
This blog provide detailed steps to install jMaki plugin, create
a simple Rails 2.0 application using NetBeans IDE and update the
generated scaffold to use a Yahoo Data Table widget for
displaying the …
We were using memcache in our application for a long time and it helped a lot to reduce DB servers load on some huge queries. But there was a problem (sometimes called a “dog-pile effect”) - when some cached value was expired and we had a huge traffic, sometimes too many threads in our application were trying to calculate new value to cache it.
For example, if you have some simple but really bad query like
SELECT COUNT(*) FROM some_table WHERE some_flag = X
which could be really slow on a huge tables, and your cache expires, then ALL your clients calling a page with this counter will end up waiting for this counter to be updated. Sometimes there could be tens or even hundreds of such a queries running on your DB killing your server and breaking an entire application (number of …
[Read more]For some reason I never was that excited about trying to accomplish these sorts of things in Perl:
1..rand(256)).inject("") {|string,n| string + ('a'..'z').to_a[rand(25)] }
This generates a string from 1 to 256 characters long, containing random letters from 'a' to 'z'.
Normally, I wouldn't use something that's quite so unreadable, but I'm starting to like Ruby's way of taking what should be a very simple operation that I might have done in 3-5 lines in Perl and boiling it down to a single line.
I'd love to see if anyone can make this more succinct (but one line is still a requirement!)
Here's the code in it's context. It's just a test script writing into my partition table every minute so I can verify my Events from previous posts are working correctly.
Sun Microsystems has released Solaris Express
Developer Edition 1/08, Sun's free OpenSolaris-based
distribution targeted at developers.
This release brings together integrated web stack (Apache, MySQL,
Ruby, Php, PostgreSQL), NetBeans 6.0, interoperability with Microsoft's
CIFS protocol, support for virtual machines via
Sun xVM hypervisor, based on technology
developed by the Xen
community, Sun HPC ClusterTools based on the Open MPI effort.
There are …
[Read more]How often do we think about our http sessions implementation? I mean, do you know, how your currently used sessions-related code will behave when sessions number in your database will grow up to millions (or, even, hundreds of millions) of records? This is one of the things we do not think about. But if you’ll think about it, you’ll notice, that 99% of your session-related operations are read-only and 99% of your sessions writes are not needed. Almost all your sessions table records have the same information: session_id and serialized empty session in the data field.
Looking at this sessions-related situation we have created really simple (and, at the same time, really useful for large Rails projects) plugin, which replaces ActiveRecord-based session store and makes sessions much more effective. Below you can find some information about implementation details and decisions we’ve made in this plugin, but if you just want to try it, then …
[Read more]
JRuby 1.0.3 was recently released and so was Rails 2.0. I decided to try JRuby 1.0.3 +
Rails 2.0 and realized that a few additional steps (because of
Rails 2.0) are required to get a trivial Hello World applcation
up and running. Here are the steps:
- Unzip JRuby 1.0.3.
- Make sure to set JAVA_HOME and JRUBY_HOME.
- Also include JAVA_HOME/bin and JRUBY_HOME/bin in PATH for convenience.
- Install Rails
2.0 as shown below:
…
Today I was developing one small merb application for one of our projects and needed to see ActiveRecord logging on console like I do in Rails. After a short research I’ve found out that merb_active_record plugin passes its MERB_LOGGER to AR by default so I decided to try to change merb log level and here they are - my pretty colored AR logs!
So, if you want to see ActiveRecord logs in your application in development mode, then you need to add one line to your conf/environments/development.rb file:
puts "Loaded DEVELOPMENT Environment..."
MERB_LOGGER.level = Merb::Logger::DEBUG
That’s it for now. Long live merb!
Using the instructions followed in JRuby Hack Day and taking some help from Nick, I figured out how to use the JDBC connection pools configured in GlassFish using the JNDI names.
All the commands given below are relevant for GlassFish but the same concept will work where ever you deploy your WARed up JRuby on Rails application.
- Follow the bullet #1 and #2 from …
The NetBeans IDE has simplified the steps to deploy JRuby on Rails application on GlassFish. This blog explains the steps and is an update to screencast #web6.
- Download the install the latest NetBeans 6 Nightly. I downloaded the Ruby pack by
clicking on the "
Download
" button in the Ruby column. - Create a new Rails Application
- Right-click in the Project window and select "
New Project...
". Take all the defaults as shown below:
- Click on …
- Right-click in the Project window and select "
ActiveRecord-JDBC 0.5 is now available. As mentioned earlier, one of the main features in this release is simplified database configuration for JRuby-on-Rails applications. From the release notes:
It is no longer necessary to specify :driver and :url configuration parameters for the mysql, postgresql, oracle, derby, hsqldb, and h2 adapters.
This means that if you deploy a Rails application as a WAR file on GlassFish as described …
[Read more]