Friday, December 28, 2012

Trends: Gradle vs Ant Ivy vs Buildr vs Maven

I recently read @apemberton   article comparing trends for Maven vs Ivy.  I wasn't surprised to see that Maven was a clear winner and even less surprised to see that the Google trend line was still in a positive direction.

However, I decided to add in a couple of other Java build tools as well - in particular Buildr and Gradle.  This is where I was surprised - Gradle surpassed Maven in terms of interest in the across the intertubes.


Now this doesn't indicate adoption or maturity, but clearly over the last 2 years, Gradle has been on a steep upward trajectory. This will surely translate into more adoption for enterprise projects and is definitely a tool that I need to spend more time learning about it.

Friday, December 21, 2012

Modifying the HomeBrew Temp Directory

Recently I switched OS X Mountain Lion to map /private/tmp to a RamDisk.  I was inspired to do this after I read this article - http://blog.alutam.com/2012/04/01/optimizing-macos-x-lion-for-ssd/

For various reasons, I also needed to move my HomeBrew temp directory out of the RamDisk.  To do this simply add an environment variable and set the location to the correct place -


In your ~/.profile or ~/.bash_profile add  HOMEBREW_TEMP and set it to the non-RamDrive temp directory:
export HOMEBREW_TEMP=/new/path 

Tuesday, September 11, 2012

Proxy Error 502, Wordpress, and OpenShift

I host the DC JBoss Users Group wordpress site (http://www.dcjbug.com) out on Openshift. This Site serves as an aggregation portal for out meetup events, jboss.org page and other interesting JBoss content.

Occasionally run into 502 Proxy Errors. After some research, I discovered that in my case it is because I routinely exceed my Disk Quota.

 I have added the WordPress Database Backup plugin and use that to periodically back up my wordpress database. However, its clearly the culprit here as the output quickly chews up free disk space.

To recover from this, remove the old backups from the server. I should add a cron job to do this, but for now, here are the manual steps that I follow:


  • ssh into my blog app on openshift ssh 
    • XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX@blog-dcjbug.rhcloud.com
  • navigate to the wp-content directory 
    • cd app-root/runtime/repo/php/wp-content/backup-#### 


  • remove old backups 
    •  rm blog_wp_201208* 
  • logout 
  • restart the application on OpenShift 
    • rhc app restart -a blog -l {your_openshift_login}

 And magically the DC JBUG Blog is back online.

Sunday, September 02, 2012

Installing ownCloud on OpenShift

ownCloud is an open source solution that allows you to have your own on-premise Dropbox clone. It comes complete with a server side and clients that can be used to sync files across clients. The latest version introduced some new features including:


  • versioning of files
  • server side encryption
  • drag and drop upload
  • theming
  • ownCloud Application APIs
  • migration and backup
  • tasks management
Now its also possible to run it on Red Hat's OpenShift using a quickstart that I recently created - owncloud-openshift-quickstart 

As I've learned in the past, files aren't persisted in the OPENSHIFT_REPO_DIR in between commits so files are stored in the OPENSHIFT_DATA_DIR location to persist the files in between commits.  Also, since there is a limited amount of disk space per Openshift application instance, I've configured this example to use a mysql backend, but sqlite and postgres are also possible.  

A mostly undocumented feature (with the exception of the mail list archives) that is essential in automating the install, I used the AUTOCONFIG option in ownCloud.  To do this do the following:
  • create an autoconfig.php file in the php/config/ directory
  • add the following to it to use the OpenShift environment variables for configuration:



     
<?php
define("DIRECTORY",$_SERVER['OPENSHIFT_DATA_DIR'] );
define("DBNAME",$_SERVER['OPENSHIFT_APP_NAME'] );
define("DBUSER",$_SERVER['OPENSHIFT_DB_USERNAME'] );
define("DBPASS",$_SERVER['OPENSHIFT_DB_PASSWORD'] );
define("DBHOST",$_SERVER['OPENSHIFT_DB_HOST'] . ':' . $_SERVER['OPENSHIFT_DB_PORT'] );
$AUTOCONFIG = array(
  'installed' => false,
  'dbtype' => 'mysql',
  'dbtableprefix' => 'oc_',
  'adminlogin' => 'admin',
  'adminpass' => 'OpenShiftAdmin',
  'directory' => DIRECTORY,
  'dbname' => DBNAME,
  'dbuser' => DBUSER,
  'dbpass' => DBPASS,
  'dbhost' => DBHOST
);
?>
Then make sure to call the index.php to trigger the import of the autoconfiguration of ownCloud. To do this, I add the following code to the post_deploy action-hook:
  • php $OPENSHIFT_REPO_DIR/php/index.php
This is in the early stages and I haven't done anything with the Sync Clients. So feel free to fork away and submit those pull requests.


Friday, August 31, 2012

Did some hacking away using the Guava Cache libraries.  Pretty cool way to handle multiple requests hitting a Web Service at one time.  Will cover more of this in an expanded blog post later on.

        cache = CacheBuilder
                       .newBuilder()
                       .concurrencyLevel(4)
                       .maximumSize(MAX_SIZE)
                       .expireAfterWrite(10, TimeUnit.MINUTES)
                       .build(new CacheLoader="jobacknowledgement">() {
                               @Override
                               public JobAcknowledgement load(Integer jobId)
                                   throws Exception {
                                   return scheduleNewJob(jobId);
                               }
                         });

Monday, August 27, 2012

Programming Language Job Trends

Just a quick glance into what languages are in demand.  .Net and Java are clearly the mainstream, but Ruby is growing.


java, ruby, scala, clojure, .net Job Trends graph
java, ruby, scala, clojure, .net Job Trends Java jobs - Ruby jobs - Scala jobs - Clojure jobs - .NET jobs

As far a view on the growth increase in demand for the languages, Clojure is clearly winning with Scala and Ruby also growing.


Of course, I'm not looking into the JavaScript, HTML5, Mobile Platforms( iOS, Android), JavaScript which clearly dominate the job trends today.


Sunday, August 26, 2012

Long Live the Bazaar Model

In a recent ACM Queue article, Poul-Henning Kamp wisely named his article - "Quality happens only when someone is responsible for it".  But I am not convinced by his claim that the Bazaar model for software engineering is a failure and is the cause for increasing complexity and lack of quality in software.

Unfortunately, to debate this article would be difficult without having a way to measure or define quality.  Fortunately, the Bazaar Model and the Open Source community have given us great tools to inspect and measure weaknesses in our code.

Some of my favorites are -

Nemo - http://nemo.sonarsource.org/
Leverages static code analysis to inspect many of the popular OSS projects out there.

Ohloh - http://www.ohloh.net/
A community driven forum for evaluating OSS projects.

Unix has clearly moved past its adolescent days.  And large systems are certainly getting more complex. But I believe that this is an effect of software entropy and not whether the software was developed in the wild or in a large cathedral.

NASA - Pioneers in Innovation

NASA has been pioneering innovation since its inception.  They are clearly the leader in Open Source adoption - both consumption and production.  But nothing sums it up better than this statement from their final report on the International Space Apps Challenge -

"Innovation is bottom-up, decentralized and unpredictable. True innovation necessitates failure. The more you experiment, the more you fail, the more you learn. Small technologies and initial development deserve innovative process and the opportunity for failure."

http://open.nasa.gov/blog/2012/08/24/what-does-it-really-mean-to-innovate/

Saturday, August 25, 2012

Introduction to Katello Video

Here's a pretty good introduction to Katello from Vinny Valdez.  It's been a while since I played with Katello and its definitely looking pretty good.



Check it out.

StatusNet powered by OpenShift

I have done a couple of proof of concept projects using StatusNet as a Twitter-like service in support of conference type applications. 2 weeks ago I had decided to work on deploying StatusNet to OpenShift as a quick and easy public facing server.

Then @JasonBrooks published his work with StatusNet at github, and it seemed like a good time to combine efforts.  Through the power of Social Coding - we now have a quickstart for running StatusNet @Openshift.

Some things I learned in doing this that are worthing noting - 
  • ACTION_HOOKS - Whatever you can imagine in a BASH script is possible for scripting setups.  Different hooks apply for different phases of the Application Life Cycle.  Most of StatusNet was written in the deploy, but 
      • pre_build  
      • build
      • deploy
      • post_deploy
    • https://openshift.redhat.com/community/blogs/a-paas-that-runs-anything-http-getting-started-with-diy-applications-on-openshift 
  • ENV variables and SSH are your friends here when validating your install scripts
    • http://www.stylesen.org/shell_openshift_express_and_environment_variables
  • All content in the OPENSHIFT_REPO_DIR is replaced with each new commit
    • If you need to persist anything (i.e. the StatusNet config.php file), copy it to the OPENSHIFT_DATA_DIR
  • Creating and removing new Applications and adding cartridges is relatively quick, but rapidly adding and removing applications repeatedly seems to cause strange issues with DNS and Mysql servers.
    • This is not unexpected as DNS requests and MYSQL DB slices are asynchronous calls throughout the system, and it will take time for changes to be finalized.
So now its possible to host your own Twitter / Yammer like service on Red Hat's OpenShift PaaS.  All in under 5 minutes.  

Simply follow the instructions here :  https://github.com/jasonbrooks/statusnet-openshift-quickstart


Thursday, August 02, 2012

Software Craftsmanship Manifesto

Have you signed the Software Craftsmanship manifesto?


"
Manifesto for Software Craftsmanship:

As aspiring Software Craftsmen we are raising the bar of professional software development by practicing it and helping others learn the craft. Through this work we have come to value:

  • Not only working software, but also well-crafted software 
  • Not only responding to change, but also steadily adding value 
  • Not only individuals and interactions but also a community of professionals 
  • Not only customer collaboration but also productive partnerships 

That is, in pursuit of the items on the left we have found the items on the right to be indispensable.
"

Tuesday, March 13, 2012

Maven and the ActiveMQ Plugin

I've been working with standing up a Quick ActiveMQ instance.  The maven plugin seems to do the trick nicely -

Step 1 - Create a maven pom

[sourcecode language="xml"]
<project>

<modelVersion>4.0.0</modelVersion>

<groupId>com.codingspaces.activemq</groupId>
<artifactId>server</artifactId>
<version>1.0.0</version>
<description/>

<build>

<plugins>

<plugin>

<groupId>org.apache.activemq.tooling</groupId>
<artifactId>maven-activemq-plugin</artifactId>
<version>5.2.0</version>
<configuration>
xbean:file:src/main/resources/activemq.xml
<fork>false</fork>

<systemProperties>
<property>
<name>org.apache.activemq.default.directory.prefix</name>
<value>./target/</value>
</property>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.2.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

</project>
[/sourcecode]

Step 2 - Create the activemq.xml config file in src/main/resources/

[sourcecode language="xml"]
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">
xmlns="http://activemq.org/config/1.0"
brokerName="vizuri"
useJmx="true">
<destinations>
<queue physicalName="receiveViaBridge" />
</destinations>
<transportConnectors>
<transportConnector name="vizuri" uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
</transportConnectors>
</broker>
</beans>
[/sourcecode]

Step 3 - Run it
mvn clean install activemq:run

Saturday, February 25, 2012

Project: Headless Appcelerator

Step 1: Create a basic maven pom with a packaging type of titanium

[sourcecode language="xml"]

<?xml version="1.0" encoding="UTF-8"?&gt;
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion></pre>
<groupId>com.codingspaces.appcelerator</groupId>
<artifactId>headless</artifactId>
<version>1.0</version>
<packaging>titanium</packaging>
<name>Appcelerator :: Headless</name>
<description>Headless Builds with Appcelerator</description>
<inceptionYear>2011</inceptionYear>
<organization>
<name>CodingSpaces</name>
</organization>
<url>http://www.codingspaces.com</url>

...

</project>
[/sourcecode]

Step 2: Add the java script plugin

[sourcecode language="xml"]
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo.javascript</groupId>
<artifactId>javascript-maven-plugin</artifactId>
<version>1.1-softec</version>
<extensions>true</extensions>
<configuration>
<platform>android</platform>
<androidAPI>11</androidAPI>
<titaniumVersion>${titanium.sdk.version}</titaniumVersion>
<titaniumSettings>
<androidSDK>${ANDROID_HOME}</androidSDK>
</titaniumSettings>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
[/sourcecode]

Maven. Appcelerator. Jasmine. Oh My!

So my latest project is an exploration into getting a headless build going for Appcelerator mobile applications complete with BDD via Jasmine.  There's an excellent Maven plugin to do pretty much all of this - javascript-maven-plugin.  Also want to add in the jasmine-species library to use a Given-When-Then specification grammar for BDD tests.

So far my toolset looks like:

The main objective is to build Appcelerator applications without having to use the development tool.  Appcelerator's IDE is actually pretty good (probably in part due to the very smart acquisition of Aptana).  However, nightly builds and being able to automatically build for multiple platforms (iPad, iPhone, Android) is a necessity and quite frankly, I'd rather substitute automation for mindless clicking of buttons.