Aug 5, 2011

Uninitialized constant Rake::DSL in Rails 3

Posted Aug 5, 2011

I got this error when I try to migrate a user model from Devise. The log says:
rake aborted!
uninitialized constant Rake::DSL
...[garbage logs]...

This problem is caused by an outdated Rake gem.   If you're rake version is less than 0.9.2 than you will experience this problem

To check Rake's version, execute this in the command line:
rake --version

You will say. But hey I just recently installed everything from Ruby to Rails gem. In my case, I got multiple installation of Rake, so I got 0.8.7 and 0.9.2 at the same time and my command line is using 0.8.7.

To be safe, I uninstalled all rake versions:
gem uninstall rake

If you have multiple versions of rake, it will ask you which version you'd like to uninstall

And install the latest again:
gem install rake

And voila! No more DSL problem when I execute
rake db:migrate

Speed-up Eclipse

Upon searching the web I cam accross several references to help improve the performance of Eclipse.

JVM Settings
For general case, you can change the JVM settings and edit your eclipse.ini
Reference: http://stackoverflow.com/questions/142357/what-are-the-best-jvm-settings-for-eclipse

-data
../../workspace
-showlocation
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vm
C:/Prog/Java/jdk1.6.0_21/jre/bin/server/jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Declipse.p2.unsignedPolicy=allow
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+CMSIncrementalPacing
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+UseFastAccessorMethods
-Dcom.sun.management.jmxremote
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:/Prog/Java/eclipse_addons

For more information on the details of the parameters, check out the reference.


http://stackoverflow.com/questions/316265/tricks-to-speed-up-eclipse also suggested to use the latest version of Eclipse and Java to improve performance.  As of writing, I'm using Eclipse 3.6 Helios and JDK 1.6.0_22.  I'm yet to update because it will take time to install the new versions, but I'm very much happy with the JVM settings.


Improve Eclipse Autocompletion

Sometimes, I experience a slow response from Eclipse when it triggers the auto-complete especially the Java Autocomplete feature. For Java, you can go to Eclise Preferences -> Java -> Editor -> Content Assist -> Advanced and you can remove the default proposals you are not using (first table).  For my case, I unchecked all except for "Java Proposals" and "Template Proposals".  For the second table, you may be wondering what content assist cycling is, this is activated when you press Ctrl+Space more than once and the content assist cycles to different proposals.  You can just uncheck all if you are not using content assist cycles.

The next thing is not really to improvement performance, but more of a preference or a setting.  You can increase / decrease the activation delay of you content assist's auto-activation feature.  This normally happens after you put a dot (.) and Eclipse tries to find proposals that suites your programmign needs.  If you go to Eclise Preferences -> Java -> Editor -> Content Assist and change the value to your liking. By default, the setting is 200 (in milliseconds), I prefer to use 0. Note though for slower computers, setting it to 0 might degrade the performance and actually slow down your coding.

--
Search Keywords:
  • eclipse speedup
  • eclipse speed up
  • speed up eclipse
  • java options eclipse performance

Aug 2, 2011

Alfresco Java Perm Gen Space Error

Posted Aug 2, 2011
As advised by Alfresco JVM Tuning, you can try to increase your max perm gen to 256M if you are encountering perm gen error (out of memory).
Modify or add this to your JVM Parameter / Settings:
-XX:MaxPermSize=256M

If you still observe this error after some time, it is possible that there is a memory leak somewhere that's causing this and you need to find where the leak happens.

Java 7 Has Finally Been Released

At long last, after 5 years of waiting and bureaucratism Java 7 is here! I still remember reading the Stackoverflow question: "Who is preventing the release of Java 1.7?" and was disappointed by Sun and Apache's dispute; reminds me of a failed democracy with too many people having a say, slowing the progress to a crawl.

Anyway, enough of ranting. Java 7 was released on July 28, 2011. It's also worth noting that this is the first Java release after Oracle bought Sun. This major release includes many new features including my favorite "strings in switch statements" and "try-with-resources statement". As a fan of Groovy language, I was excited by this release because it includes the much awaited JSR292 which aims to support the implementation of dynamically-typed languages promising significant performance gain. For more information about the implications of JSR292, read Baptiste Wicht's article.

For more information on the new features and enhancements, check out the release notes.  Java Development Kit (JDK) 7 is available for download here.