• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Noulakaz

Noulakaz

The blog of Avinash, Christina, Anya and Kyan Meetoo.

  • Home
  • About
  • People
    • Christina & Avinash Meetoo
    • Avinash Meetoo
    • Christina Meetoo
    • Anya Meetoo
    • Kyan Meetoo
  • General
    • News
    • Mauritius
    • Politics
    • Education
    • Business
    • Travel
  • Computing
    • Apple
    • Linux
    • LUGM
    • Programming
    • Web
    • Technology
    • Knowledge Seven
  • Entertainment
    • Music
    • Movies
    • Photography
    • Sports

Avinash Meetoo

Times to Stop Charging for Parts of Its Web Site

18 September 2007 By Avinash Meetoo 11 Comments

The New York Times will stop charging for accessing parts of its web site including 20 years of archive (from 1987 onwards).

The reason is (I quote):

“The business model for advertising revenue, versus subscriber revenue, is so much more attractive. The hybrid model has some potential, but in the long run, the advertising side will dominate.”

Fantastic! Instead of making us pay, the New York Times will get its money from advertising.

As a corollary, is it possible to have a (paper) newspaper in 2007 which does not have a website with 100% free content? Will that be possible in 2010? I have my doubts.

Filed Under: News, Technology, Web

Alternative languages for the Java VM

18 September 2007 By Avinash Meetoo 7 Comments

According to Wikipedia,

A Java Virtual Machine (JVM) is a set of computer software programs and data structures which implements a specific virtual machine model. This model accepts a form of computer intermediate language, commonly referred to as Java bytecode, which conceptually represents the instruction set of a stack-oriented, capability architecture. This code is most often generated by Java language compilers, although the JVM can also be targeted by compilers of other languages.

This clearly indicates that any programming language that has a compiler that can produce Java bytecode can be used to write programs that run on the JVM.

In addition to the Java programming language, Robert Tolksdorf has created an exhaustive list of around 200 other programming languages that can be used to write programs that run on the JVM. The ones that I am interested in currently are (in alphabetical order):

  • Bistro
  • Groovy
  • JRuby (aka Ruby on the JVM)
  • Jython (aka Python on the JVM)
  • Nice
  • Rhino
  • Scala
  • SISC (aka Scheme on the JVM)

Personally, as a fan of Ruby, I am watching JRuby very closely.

Which one do you want to watch today? :-)

Filed Under: Programming, Technology

The significance of JRuby and GlassFish

15 September 2007 By Avinash Meetoo 39 Comments

JRuby is a 100% pure-Java implementation of the Ruby programming language.

I have already written about the beauty and power of Ruby and how all smart people should start using it as soon as possible…

In essence, it allows programmers to write programs in Ruby which run on the Java Virtual Machine. The Ruby programming language is better (IMHO) than the Java programming language and, consequently, one can be more productive using Ruby than Java.

For example, this is a small Java program that reads words from the standard input and output the signature of the word (i.e. the letters of the word in sorted order) followed by the word. Cultured readers will recognize an exercise from Programming Pearls by Jon Bentley:

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

import java.util.Collections;
import java.util.Vector;

public class Sign
{
    public static void main(String[] args)
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        
        while (true) {
            String word = null;
            
            try {
                word = in.readLine();
            }
            
            catch (IOException e) {
                System.exit(1);
            }
            
            if (word==null) {
                break;
            }
            
            Vector<Character> letters = new Vector<Character>();
            
            for (int i=0; i<word.length(); i++) {
                letters.add(word.charAt(i));
            }
            
            Collections.sort(letters);
            
            for (Character letter : letters) {
                System.out.print(letter);
            }
            
            System.out.println(" " + word);
        }
        
        System.exit(0);
    }
}

46 lines! Not too bad for Java incidentally. Notice that I’ve used generics that have been introduced in Java recently. The heart of the program reads a word in a string, sends its characters to a vector, sort that vector and, finally, output the letters in sorted order.

The same program in Ruby is:

while word = gets
    word.chomp!
    letters = word.split("")
    letters.sort!
    puts letters.join("") + " " + word
end

which is an order of magnitude shorter and clearer (chomp! is used to strip the newline from the end of the word when input).

This program is a normal Ruby program and, hence, using Jruby it can be run atop a JVM. I’ve done some tests on my MacBook on a list of 234,936 English words:

Interpreter Runtime
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin] 5.702s
ruby 1.8.5 (2007-06-07 rev 3841) [i386-jruby1.0] 26.347s
java version “1.5.0_07” 19.978s

From this, I conclude that for small programs, plain Ruby is quicker than anything that run on the JVM (another conclusion is that JRuby’s performance is comparable with Java). This is understandable because the Ruby interpreter is designed for small programs like this. But what about when you have to run a substancial Ruby on Rails application?

According to some important people, this is where JRuby really shines…

JRuby allows Ruby on Rails applications to run on a industrial-grade J2EE application server so much so that people have started predicting the demise of pure Ruby application servers like Mongrel. With the emergence of GlassFish, a free, open source, production-quality, enterprise J2EE application server, it becomes quite reasonable to use the following architecture to deploy easy-to-write yet enterprise-grade web applications:

Exciting times indeed :-)

18 September: an update

Eddy has a much quicker version of my Java program that runs in 4.222s and is therefore quicker than the plain Ruby version and is around 6 times quicker than the JRuby version. Eddy uses toCharArray() instead of sending the individual characters of the String in a Vector.

Thanks!

Post Scriptum

If you read the comments, you’ll see that a number of people are missing the point of this post. Maybe it’s badly written. The point is that Ruby of Rails applications can now run on JRuby which can itself run on GlassFish which is a good thing in my opinion.

Filed Under: Education, Programming, Technology, Web

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 160
  • Page 161
  • Page 162
  • Page 163
  • Page 164
  • Interim pages omitted …
  • Page 273
  • Go to Next Page »

Primary Sidebar

Our Personal Websites

Avinash Meetoo
Christina Meetoo
Anya Meetoo
Kyan Meetoo

Archives

  • May 2025 (1)
  • April 2025 (4)
  • January 2025 (3)
  • December 2024 (2)
  • November 2024 (2)
  • October 2024 (3)
  • September 2024 (7)
  • August 2024 (1)
  • July 2024 (1)
  • June 2024 (2)
  • May 2024 (3)
  • January 2024 (2)
  • December 2023 (1)
  • October 2023 (1)
  • September 2023 (4)
  • August 2023 (3)
  • July 2023 (1)
  • June 2023 (4)
  • May 2023 (1)
  • April 2023 (1)
  • March 2023 (5)
  • February 2023 (1)
  • December 2022 (1)
  • November 2022 (1)
  • October 2022 (4)
  • August 2022 (4)
  • July 2022 (3)
  • June 2022 (5)
  • May 2022 (5)
  • January 2022 (3)
  • December 2021 (2)
  • November 2021 (1)
  • October 2021 (1)
  • September 2021 (4)
  • August 2021 (2)
  • July 2021 (14)
  • May 2021 (2)
  • April 2021 (4)
  • March 2021 (9)
  • February 2021 (2)
  • January 2021 (1)
  • October 2020 (1)
  • September 2020 (1)
  • August 2020 (2)
  • July 2020 (5)
  • June 2020 (3)
  • May 2020 (5)
  • April 2020 (6)
  • March 2020 (2)
  • February 2020 (2)
  • January 2020 (2)
  • October 2019 (1)
  • September 2019 (2)
  • July 2019 (2)
  • June 2019 (1)
  • May 2019 (3)
  • April 2019 (2)
  • March 2019 (1)
  • February 2019 (1)
  • January 2019 (3)
  • December 2018 (1)
  • October 2018 (3)
  • August 2018 (2)
  • July 2018 (2)
  • June 2018 (1)
  • May 2018 (2)
  • April 2018 (1)
  • February 2018 (1)
  • December 2017 (1)
  • October 2017 (1)
  • September 2017 (1)
  • August 2017 (1)
  • July 2017 (1)
  • May 2017 (4)
  • April 2017 (3)
  • March 2017 (4)
  • February 2017 (5)
  • January 2017 (3)
  • October 2016 (1)
  • September 2016 (1)
  • August 2016 (4)
  • July 2016 (1)
  • June 2016 (1)
  • March 2016 (3)
  • February 2016 (3)
  • January 2016 (1)
  • December 2015 (1)
  • November 2015 (2)
  • September 2015 (1)
  • August 2015 (3)
  • March 2015 (1)
  • December 2014 (1)
  • November 2014 (4)
  • October 2014 (1)
  • March 2014 (2)
  • February 2014 (3)
  • December 2013 (1)
  • October 2013 (1)
  • September 2013 (1)
  • August 2013 (1)
  • July 2013 (1)
  • June 2013 (2)
  • May 2013 (1)
  • March 2013 (3)
  • January 2013 (2)
  • December 2012 (3)
  • November 2012 (4)
  • September 2012 (3)
  • August 2012 (2)
  • July 2012 (3)
  • June 2012 (2)
  • May 2012 (1)
  • April 2012 (2)
  • February 2012 (1)
  • January 2012 (4)
  • December 2011 (2)
  • November 2011 (1)
  • October 2011 (4)
  • September 2011 (2)
  • August 2011 (1)
  • July 2011 (2)
  • June 2011 (4)
  • April 2011 (7)
  • March 2011 (2)
  • February 2011 (1)
  • January 2011 (3)
  • November 2010 (3)
  • October 2010 (1)
  • September 2010 (2)
  • August 2010 (4)
  • July 2010 (2)
  • June 2010 (1)
  • May 2010 (3)
  • April 2010 (4)
  • March 2010 (3)
  • February 2010 (3)
  • January 2010 (5)
  • December 2009 (2)
  • November 2009 (3)
  • October 2009 (1)
  • September 2009 (5)
  • August 2009 (3)
  • July 2009 (1)
  • June 2009 (3)
  • May 2009 (2)
  • April 2009 (7)
  • March 2009 (12)
  • February 2009 (10)
  • January 2009 (5)
  • December 2008 (4)
  • November 2008 (11)
  • October 2008 (6)
  • September 2008 (7)
  • August 2008 (3)
  • July 2008 (8)
  • June 2008 (6)
  • May 2008 (5)
  • April 2008 (7)
  • March 2008 (6)
  • February 2008 (3)
  • January 2008 (6)
  • December 2007 (11)
  • November 2007 (10)
  • October 2007 (7)
  • September 2007 (9)
  • August 2007 (3)
  • July 2007 (7)
  • June 2007 (8)
  • May 2007 (14)
  • April 2007 (11)
  • March 2007 (18)
  • February 2007 (14)
  • January 2007 (15)
  • December 2006 (16)
  • November 2006 (10)
  • October 2006 (7)
  • September 2006 (8)
  • August 2006 (8)
  • July 2006 (6)
  • June 2006 (4)
  • May 2006 (13)
  • April 2006 (10)
  • March 2006 (11)
  • February 2006 (7)
  • January 2006 (14)
  • December 2005 (8)
  • November 2005 (6)
  • October 2005 (7)
  • September 2005 (2)
  • August 2005 (6)
  • July 2005 (2)
  • June 2005 (6)
  • May 2005 (15)
  • April 2005 (12)
  • March 2005 (3)
  • February 2005 (8)
  • January 2005 (3)
  • December 2004 (1)
  • November 2004 (2)
  • October 2004 (2)
  • September 2004 (3)
  • August 2004 (3)
  • July 2004 (3)
  • June 2004 (3)
  • May 2004 (6)
  • April 2004 (10)
  • March 2004 (12)
Creative Commons License This work is licensed by Avinash Meetoo under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License.