Saturday, October 15, 2011

wmii ubuntu 11.10 (Oneiric Ocelot)

The default gcc compiler now requires linked libraries to appear after the source file
gcc example.cpp -lsomelibrary
wmii build files have the shared libraries located before the source files, and thus can not be easily built with the default configuration.
To build wmii I updated the config.mk to use gcc-4.4 for the compiler
CC = gcc-4.4 -c
LD = gcc-4.4
This allowed the project to compiled with the following command:
dpkg-buildpackage -rfakeroot -us -uc -b

Thursday, September 29, 2011

Fix clang errors in ubuntu

In natty clang needs some the headers that are not included in ubuntu. To get clang to work use the following:
sudo ln -s /usr/include/c++/4.5 /usr/include/c++/4.4

Wednesday, September 14, 2011

When debugging in python, I use ipython's ipdb debugger to set breakpoints. I can add the following code in the location I want to stop:
import ipdb; ipdb.set_trace()
I wanted something similar for ruby. I got the same behaviour set up with the following code and patching using irb_completion's output. Install the required gem files:
gem install ruby-debug-base
gem install ruby-debug
gem install wirble
gem install patch_irb_completion;patch_irb_completion
Modify the ruby file to be debugged:
require 'rubygems'
require 'ruby-debug'
require 'wirble'
Wirble.init
Wirble.colorize

debugger #location to stop
running the code with the --debug option will stop at the requested location and drop an rdb prompt with tab completion. Reference: http://stackoverflow.com/questions/2504515/what-do-i-put-in-my-ruby-jruby-code-to-break-into-the-debugger http://www.unboxedconsulting.com/blog/irc-completion-from-the-debugger

Sunday, July 10, 2011

SpringSource Tool Suite 2.7.0.M2 Released

Eclipse 3.7 (Indigo) has been released.
From the eclipse website install the Java EE version and follow the directions found at this website link to install the SpringSource support.

Wednesday, June 22, 2011

generate database DDL

Roo automatically generates the database but does not provide a DDL. To generate a DDL add the following text to the pom:
<!-- Generate DDL -->
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>hibernate3-maven-plugin</artifactId>
  <version>2.2</version>
  <executions>
<execution>
  <phase>process-classes</phase>
  <goals>
    <goal>hbm2ddl</goal>
  </goals>
</execution>
  </executions>
  <configuration>
<components>
  <component>
    <name>hbm2ddl</name>
    <implementation>jpaconfiguration</implementation>
  </component>
</components>
<componentProperties>
  <propertyfile>src/main/resources/database.properties</propertyfile>
  <persistenceunit>persistenceUnit</persistenceunit>
  <outputfilename>schema.ddl</outputfilename>
  <drop>false</drop>
  <create>true</create>
  <export>false</export>
  <format>true</format>
</componentProperties>
  </configuration>
</plugin>

Friday, June 10, 2011

roo reverse engineer

These are the steps I followed to have roo generate the database entities.
mkdir project
cd project
roo
In roo type the following to create a project along with the persistence layer.
project --topLevelPackage com.tecunhuman.example
persistence setup --provider HIBERNATE --database POSTGRES
exit roo and modify the file "src/main/resources/META-INF/spring/database.properties" to contain the correct information for the database. run roo again and execute:
database reverse engineer --schema schema-name
It will inspect the database and generate the DAO classes.

Thursday, June 9, 2011

Java rooing with xjc

I have been working on web services using java and found some useful tools to speed up development time. I have been using xjc to generate the web resource entities based on the provided schema. This program generates the classes used for the rest service along with the required annotations. Roo is another tool that generates code. It has an option to reverse engineer a database. This allows creating classes with annotations from an existing database. Our stack requires us to use java, spring and hibernate; roo allows creating entities with test in a fraction of the time.

Thursday, June 2, 2011

In the clouds

My blog is now being hosted on the clouds. It was able to migrate by moving the database and content files. I ran into problems with the themes. I had set the default theme in the database to be able to view anything.
I also moved the repository I use to configure my machine into bitbucket. I figured someone might find them useful. I separated part of it into its own project; searchvim is a project I created to make switching between files in vim simple. I tried to simulate a similar behaviour to that of eclipse or intellij. If someone finds it useful or has suggestions let me know.