Archive for the ‘JRuby’ Category

Encoding and JRuby on Rails

Март 1st, 2011

Studing JRuby and Rails, I faced some encoding problems. The solution was very easy. First you must have to create your database using utf8 character set. In case you are using MySQL, just do the following:

CREATE DATABASE `yourdatabasename` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

or

ALTER DATABASE yourdatabasename CHARACTER SET utf8 COLLATE utf8_general_ci;

If you already have a database with records, read this post from @akitaonrails.

In my case, I’m using the activerecord-jdbc-adapter gem, and connecting to the database through the MySQL JDBC Connector.

At this time, I just have downloaded the JDBC driver (.jar file), and copied to $JRUBY_HOME/lib folder (if you are using RVM, find the JRuby installation folder using the rvm debug or rvm info command).

Lastly, I just have set the following parameters into connection string (in database.yml file):

jdbc:mysql://localhost:3306/yourdatabasename?characterSetResults=UTF-8&characterEncoding=UTF-8&useUnicode=yes

Maybe this will be useful to someone.
See ya!

 




PlanetMySQL Voting: Vote UP / Vote DOWN

SAP as a case study for open source engagement

Февраль 11th, 2010

There was some incredulity expressed yesterday when I suggested that SAP is a great case study on the way in which proprietary companies have engaged with open source.

To be clear, I was not suggesting that SAP is, or should be considered, an open source company, but based on our understanding of SAP’s changing strategy with regards to open source software it represents a good case study on how proprietary companies have learned that it is in their best interests to contribute to open source software projects.

Jay and I had the opportunity yesterday to speak to Claus von Riegen, SAP director of technology standards and open source, and Erwin Tenhumberg, SAP open source program manager. Our formal assessment of the company’s strategy with regards to open source will be published in due course, but given the disbelief expressed about SAP’s strategy, I thought it was worth publishing some edited highlights.

  • The company’s strategy is not perfect, and it has made mistakes in the past, not least Shai Agassi’s dismissal of open source as an innovative development model, and the initial release of the SAP DB code under the GNU GPL (as we documented in our November 2008 report - clients only - the company has admitted that it did not properly understand the governance required to create a successful open source project and manage community contributions with that effort).
  • Due to those mistakes, perhaps, SAP has been slow to embrace open source, despite becoming a founding member of the Eclipse Foundation in 2004. That move was motivated by a realization that open source software provided an opportunity to reduce development costs for non-differentiating features and in 2005 the company began documenting the formal processes required for the use of open source software within its internal development projects.
  • That documentation effort is representative of the cautious approach SAP has taken to open source but it has arguably paid off - the processes for the use of open source have subsequently become baked-in to the company’s overall software development and productization process.
  • Another reason that SAP’s progress has been slow is that until 2006 every proposal to make use of open source software had to be approved by the company’s executive board. Clearly that system was unworkable and it has subsequently been replaced by delegation to executives that lead the company’s individual business units.
  • In 2007 SAP began formally contributing to Eclipse projects with the company having realized that it did not make economic sense to maintain its own code patches and modifications and that it stood to gain by proactively contributing to projects. That decision prompted the company to start work on the policies and processes that would be required to enable greater contribution to open source software projects.
  • The processes for expanded contribution were accepted by the executive board in December 2008 and are also now part of the productization process. The impact has been a significant increase in the number of projects that SAP contributes to has jumped from three in late 2008 to more than 25 today.
  • June 2009 saw the company increase its Eclipse membership level from strategic consumer to strategic developer in line with the company’s enhanced contributions. As a result of this increased activity SAP was the third-largest corporate contributor to Eclipse in 2009 in terms of lines of code, with 1.8 million.
  • In October 2009 SAP announced that it was also joining a number of Apache Software Foundation projects, including the Chemistry implementation of the CMIS implementation as well as Maven, VXQuery, Tomcat, OpenEJB and ActiveMQ.
  • Other projects that SAP have contributed to include Ruby on Rails and JRuby, primarily motivated by its use of these technologies in its Business Objects business intelligence software.
  • The company is now routinely seeing product units request open source use and contribution approval at the same time, indicating that the benefits of contribution have been widely accepted.

There is a lot more to SAP’s open source story than that - see our formal report for details on the due diligence checks performed by SAP on its code use, as well as plans to encourage more open source development from the members of its SAP Developer Network for example (I’ll add the link when the report is available) - but there is a clear journey that SAP has been on that continues to drive it towards even greater use of, and contribution to, open source software. Progress has arguably been slow, but the previous barriers to contribution have been lowered and the diligence that SAP has shown in putting processes and policies in place have put it in a good position to be able to benefit from greater involvement with open source projects.

Software patents

Of course some issues remain. On a related issue, one of the most significant for free and open source advocates is the company’s attitude towards software patents. A good explanation as to why this is the case is provided by Glyn Moody.

I asked Claus and Erwin for their perspective on SAP’s stance on software patents and how that impacted the perception of SAP. Part of the response was the expected position that as SAP exists in a world where there are software patents it has no choice but to engage in patenting software itself if it is to retain a strong position against competitors. The other, with specific reference to open source, was as follows:

    “SAP actually is a big proponent of strong and concise IPR licensing regimes for all standards and open source initiatives we participate in. Whatever claims of patents and patent applications that essentially need to be infringed to implement a standard or use an open source component should always be licensed in a reasonable and non-discriminatory manner by the individuals and organizations that have contributed to the project (obviously, in open source projects RAND means royalty-free). SAP does participate in open source projects particularly in order to drive adoption of a certain technology. There may be SAP patents in that very domain and they may be essential, but we require ourselves to freely license those patents to everybody. But we expect the same from any other project participant. And that’s actually why we prefer governance models like the one from the Eclipse Foundation (that also comprises contribution analyses in order to minimize unintentional copyright infringements).”


PlanetMySQL Voting: Vote UP / Vote DOWN

Track your running miles using JRuby, Ruby-on-Rails, GlassFish, NetBeans, MySQL, and YUI Charts

Июль 29th, 2009

This blog introduces a new application that will provide basic tracking of your running distance and generate charts to monitor progress. There are numerous similar applications that are already available/hosted and this is a very basic application. What's different about this ?

The first version of this application is built using JRuby, Ruby-on-Rails, GlassFish Gem, MySQL, and NetBeans IDE. This combination of technologies is a high quality Rails stack that is used in production deploymnet at various places. Still nothing different ?

A similar version of this application will be built using a variety of Web frameworks such as Java EEGrails, Wicket, Spring and Struts2 (in no particular order). The goal is to provide a similar application, slightly bigger than "Hello World," built using different frameworks and deploy on GlassFish. Each framework will then be evaluated based upon the criteria ranging from the basic principles of framework, ease-of-use in design/development/testing/debugging/production of this web app, database interaction, tools support, ability to add 3rd party libraries, browser compatibility and other points. 

An important point to note is that this is not an exhaustive evaluation of different Web frameworks and the scope is limited only to this application.

A complete list of frameworks planned is available here. The criteria used to evaluate each framework is described here. Your feedback in terms of Web frameworks and evaluation criteria is highly appreciated.  Please share your feedback on the users list.

Now the first version of application. The complete instructions to check out and run the Rails version of this application are available here.

Here are some charts generated using the application:



and



YUI is used for all the charting capabilities.

And here is a short video that explains how the application work:



If you are a runner, check out the application and use it for tracking your miles. A sample runlog is available in "test/fixtures/runlogs.yml" and races in "test/fixtures/races.yml".

If you know Rails, please provide feedback if the application is DRY and using the right set of helpers.

If you'd like the existing list of web frameworks to be pruned or include another one to the list, let us know.

Share you feedback at users@runner.kenai.com.

Technorati: jruby rubyonrails glassfish netbeans mysql yahoo yui chart running miles framework