Category: Dev Env

Getting Started: Emacs & C++ (w/ cmake) (On the fly syntax highlighting)

I am a recent convert to emacs. My vast majority of development is in Java EE and I have not found an easy way to get the functionality in eclipse into emacs. So I still use eclipse for this.

However, I like to tinker with C++ and I wanted to get some of the CDT functionality into emacs. In truth, I have used very little CDT so my expectations from emacs will be set differently. Considering that emacs has been used for C/C++ development for decades, I am hopeful that it will be more feature-rich than eclipse or any of the other IDE’s like Anjuta, Code::Blocks etc (both I have tried to use).

First things first. In the world of Java, I am a massive fan of maven which makes build management so easy and simple. Having used it now for years, it is easy to forget how much of a learning curve it had to get started.

Autotools are a massive pain to use and has a very steep learning curve. I have used it in the past to set up build environments and it works fine. pkg-config is pretty awesome and in a lot of ways, maven does pale in comparison. i.e. instead of having maven pull in dependencies, you just use your systems package manager like apt-get or yum and it installs the libraries for you.

Read more »

Maven2, EJB3 and JBoss

I started work on a project called InVision about a year ago but have probably spent about a week or two worth of effort on it in total… :-(

The Project aim was to bring together the easy time logging capabilities of Process Dashboard along with the project management capabilities of Microsoft Project (including the Server Component). It is also to be integrated into our request tracking System – Request Tracker. Eventually, it is also to integrate with our accounting system and turn into an ERP (Enterprise Resource Planning) system and MIS (Management Information System). There are plans to integrate with our Wiki and our Document Management System too.

But these are all lofty goals.  One of our recent projects introduced me to the Spring Framework. While I am still not a fan of Spring, the scale of the project and the way of approaching it gave me some ideas and additional tools to work with. I wanted to bring these into the InVision Project.

The key one here was Maven 2. InVision already used EJB3 and JBoss (4.2 as it happened). There was one additional issue for me to resolve and that was out of container testing. Something that is very easy to do with Spring but a little more troublesome with EJB3 since it doesn’t have an out of container framework…

I have grown to be a big fan of Maven 2 and using Maven 2 to configure an EJB project is not as easy or straightforward as I would have liked: I wanted to separate the whole project into four parts

  • Domain Model (or just the entity beans); Also referred to as a Hibernate Archive (HAR)
  • Stateful/Stateless Beans (Just the Beans, since I don’t consider entities beans in EJB3)
  • Application Client (J2SE Application)
  • Web App (Using SEAM)
  • I would also need an EAR project to deploy the DomainModel, Beans & WebApp as one pacakge into JBoss.

I have not got as far as the SEAM project yet but the other ones were straightforward enough to set up with Maven 2.

Both the Domain Model and the Beans project had to be set up as ejb projects and use the maven-ejb-plugin




org.apache.maven.plugins
maven-ejb-plugin

3.0



I set up the persistence context within the Domain Model


org.hibernate.ejb.HibernatePersistence
java:/datasource

I could then reference the context from the Beans project by injecting it with

@PersistenceContext(unitName=”em”)

Easy enough!

Now configuring the EAR project: This was configured as an ear package which depended on the other two projects with the following configuration




org.apache.maven.plugins
maven-ear-plugin

5


uk.co.kraya.invision
beans


uk.co.kraya.invision
DomainModel



4.2

invision-ds.xml





org.codehaus.mojo
jboss-maven-plugin



8080



With this configured, from the EAR project, I could do mvn ear:deploy to deploy to JBoss.

Additionally, within eclipse, I created a new run-type that ran ear:undeploy package ear:deploy to re-deploy the package to JBoss. Works a treat

There are still a few kinks to be ironed out.

I still need to install (mvn install) the two projects before the EAR will pick it up to deploy. I need to get the ear re-deploy to re-build the other projects. Something to look at another day.

I had manually deployed the DataSource file to JBoss. It might be possible to do this via Maven.

I also very much liked the Eclipse automatic deploy feature. It is possible to use the eclipse plugin on maven to get Eclipse to identify this as a JBoss deployable project but I ran into some problems and gave up. Ideally, Eclipse would auto-deploy the project.

However, the above is less relevant once Out-Of-Container testing is in place. Now, this does work, but I will leave that to another day…

Eclipse TPTP on Ubuntu (64bit)

I run ubuntu 64 bit (technically, I run an ubuntu 64bit vserver which I access from ubuntu 32 bit but thats not really relevant).

In the open source world, I expect that all things which are accessible as 32bit are also accessible and 64bit and ubuntu makes it automagic enough that everything just works. Yes, I run into problems with closed source software like Flash Player (recently resolved with flash player 10) and the Java Plugin but that is another story. I use Eclipse and wanted to do some performance analysis and benchmarking to find a bottleneck and installed the TPTP plugin; and ran into a problem. It just didn’t work.

To resolve it, I turned to google… In this instance, it turned out to be a distraction and a red-herring. It lead me in the direction of installing libstdc++2.10-glibc2.2_2.95.4-27_i386.deb which was difficult at best since there was only a 32bit version of the package and that wasn’t even in the standard repository.

In the end, digging deeper, I found that it simply missed the following shared object libstdc++.so.5.

All I had to do was install libstdc++5:

sudo aptitude install libstdc++5

and it worked… 😀

Now, I think that ACServer which Eclipse uses to do TPTP should not link to an outdated library but that is another issue…

WordPress Themes