JRuby is a pretty good Java implementation of Ruby. One of the biggest advantages of JRuby is that you can use Java Classes in your Ruby on Rails App. You can import JARs and take advantages of all the Java Libraries and Frameworks. In that way you don’t have to throw away your old Java Code. You can build a JAR and use it inside your new fancy Ruby App.
I recommend to build a Uber JAR, which contains all dependencies of your Java App. That is more easy to handle. You have to put your Uber JAR into the “lib” directory of your rails app. Than you have to import the JAR in the “application.rb”.
That’s it! Know you can access the Classes inside the JAR. If you want to use a Java Class in a Controller you have to include the class:
class PageController < ApplicationController
locationService = LocationFactory.locationService
@locations = locationService.locations
javac is generating byte code. groovyc is generating byte code. bothe are generating byte code for the jvm. From the byte code perspective their is no different between java and groovy. And in the IDE, IntelliJ IDEA, you can easily mix Java classes with groovy classes. No Problem. No errors and no warnings. But as soon you try to compile and to execute everything you get trouble. I did some research and found this article here:
It basically says that if you are mixing java and groovy and you have dependencies between them, than it does not work. Because your code at first get compiled with javac and than with groovyc. You have to use interfaces to resolve the dependencies.
Common! Are you serious? Of course their are dependencies if you are mixing java with groovy! And I don’t want write for every single PoJo a fu**ing Interface. That is the Enterprise Overhead approach I try to avoid with a scripting language.
And why it is not possible to compile groovy with javac? I mean their is JSR for groovy. It is standard. It is from the same vendor. And in the end it is anyway just byte code for the JVM. It would absolute make sense! And in that way the groovy + java mix mode problem could be resolved easily.
Nearly everywhere in the USA WiFi is for free. In every Startbucks, in over 10000 McDonalds, on Airports and even in some Safeway’s. But not in the Hilton Hotels. At least not in Austin. You pay 200 Bugs for a night and if you want to have internet you should pay $90 extra.
Isn’t that ridiculous? In Mariott the WiFi is free!
Thank God that Teathering on Android Phones is free.
I am familiar with Ruby on Rails. I think that is the best Framework for Web Development. Yesterday I installed JRuby. That is the Ruby language implemented in Java. It is pretty good. Here is the Homepage:
On the Download Page there is a bundle for Mac OS X, too.
The installation worked pretty smooth. After the installation you can use in the command line like that:
jruby -S --version
You can install the rails framework like that.
jruby -S gem install rails
and create a new project like that
jruby -S rails new blog
It works pretty good. And with JRuby you can directly access Java classes. You can import JAR files and take advantage of the whole Java world.
I am playing around with JRuby and Neo4j as Graph Engine. My set up on the backend side contains a Java Application with Spring Annotations, AspectJ and Neo4J. In the frontend I have a Rails App with JRuby.
Any time I try to access a class that have an annotation like “@NodeEntity”, I get an Exception. It seems that Spring and AspectJ is to much in this chain. I should get rid of Spring and AspectJ.
By default maven is generating a small JAR file, which just contains your compiled classes and other project files. If you want to have a single JAR file which also includes all dependent JAR files, you have to create a uber JAR. You can do that with the maven shade plugin. Just put this lines of xml into your pom.xml.
If you are working with Debian Linux you have to the package manager “apt-get” to install packages. What is pretty cool. 1 mil. times better the the shitty RPM System from Red Had. If you want to have autocompletion for apt-get install the package “bash-completion”.
apt-get install bash-completion
and than add this lines to your “/root/.bashrc” file:
if [ -f /etc/bash_completion ]; then
I tried to write a insert statement with Spring JDB Template for an PostgreSQL Database. My insert string looked like this:
final String sql = "INSERT INTO products (prod_name, prod_key, artifact_id, group_id, link, src, prod_type) VALUES ('?','?','?','?','?','?','?')";
And I got this Exception:
PreparedStatementCallback; SQL ; The column index is out of range: 1, number of columns: 0.; nested exception is org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.
The Problem was that I used ” ‘ ” inside of the sql string close to the “?”. After I removed the ” ‘ ” strings it worked perfectly.
If you want to create a new Product, you need a name for it. Assume you have a list with 5 possible names. You are asking a couple of people which name they would choose. Some of the people will ask you what your product is about. But that is not so important.
What have Yahoo or Google to do with Search? Of course everybody is associating Yahoo and Google with Search. But that is just because of the branding in the last years.
And what’s about Audi and Mercedes. The same like with Google and Yahoo. And what to hell have Heroku to do with an AppEngine. Just from the name, nothing. But every Ruby on Rails Developer in Silicon Valley nows Heroku. It’s just because of the Branding.
On Mac OS X Ruby 1.8.X is already pre-installed. But if you want to have the newest version 1.9.X you have to install it again. I assume that you installed already XCode and MacPorts on your machine. Than you have update your MacPorts
sudo port selfupdate
All right. Now you can install the newest version.
sudo port install ruby19
That’s it. Now you have to versions of Ruby on your computer. Check the version.
Last Monday and Tuesday I went to the GigaOM Mobilize Conf. Here are my notes from the conference:
Adds go over to recommandations, reviews, comments
The user is the OS
Privacy is the currency
Mashup needs Orchestrators
Fjord, small products.
Pandora -> HTML 5 -> No Flash
80% of usa takes their infos from radio
Spotify -> Facebook
60% usage of apps. 9% browser
Primetime is afternoon, a little bit in the night.
Tablets used in prof. Areas.
Mostly used for watching tv.
Most people with iPhone and iPad are using iPhone during the day. In the evening, at home, they are using much more the iPad.
New formats of advertisements
Advertisements should focus on locationbased services.
Adds as usefull information.
Relationship with user is very important.
Critical mass is important for adds. Specially local users.
Voice just 4% of net traffic
Voice as api in Apps
8 billion USD for roaming, every year, worldwide
Intuit 15 mill. Customers.
lumoback.com (Eric schmidt)
The arduino platform. The Linux for Hardware devices.
Tingle (mobile local dating), buy Karma! :-)