How to get notified about out-dated dependencies in build.sbt?

Scala SBT is the build tool for the programming language Scala. You can specify your project dependencies in the “build.sbt” file, similar to the pom.xml file in Maven. A build.sbt file can look like this.

name := "s3crate"

organization := "codexica"

version := "0.0.1-SNAPSHOT"

scalaVersion := "2.10.2"

libraryDependencies += "net.java.dev.jets3t" % "jets3t" % "0.9.0"

libraryDependencies += "com.amazonaws" % "aws-java-sdk" % "1.3.33"

But how do you get notified about new versions of your dependencies?

VersionEye now supports Scala SBT. VersionEye can monitor your build.sbt file on GitHub / Bitbucket. If you are logged in to VersionEye you just have to navigate to your GitHub / Bitbucket repository and flip the switch beside the build.sbt file.

01-VersionEye-SBT

After fetching and parsing the build.sbt file successfully the file name turns into a link. You can enter the project detail view by clicking on the link. Here you can see which of your dependencies are out-dated and what is the current version.

02-VersionEye-SBT

By clicking on the Link “Visual Dependencies” VersionEye will show you all transitive dependencies, visualized as a super cool JavaScript Graph :-)

03-VersionEye-SBT

VersionEye will check your build.sbt file once a week and send you email notifications about out-dated dependencies. If everything is up-to-date you will get no email.

Facebook Share Link

Let’s say you have an awesome social network, a dating platform for cars, and you want to share your cars profile on Facebook. It should look like this. How do you do that?

share

First of all you should load Facebooks JavaScript SDK. Insert this code below the “body” tag in your page.

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=99999999999999&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));
</script>

Replace 99999999999999 with your Facebook App ID. Next you need a JS function to trigger the share dialog. That can look like this:

function share_my_car(kfz, kfz_id, image_url){
  url_to_share = "http://contactmycar.de/cars/" + kfz_id;
  FB.ui({ method: 'feed',
          name: kfz,
          caption: 'Mein Fahrzeug auf ContactMyCar',
          picture: image_url,
          link: url_to_share }, function(response) {});
}

And finally you need a link/button to trigger the JS function. I used a link.

<a onclick="share_my_car('<%= car.kfz %>', '<%= car.id %>', '<%= car.image_url %>'); return false;" href="">
 Fahrzeug auf Facebook teilen
 </a>

That’s it.

Global Variables with Ansible

Ansible is a great tool for IT automation. It’s similar to Chef and Puppet, just better! 

I wrote here already an introduction to Ansible. In Ansible you have roles and playbooks. A playbook can contain several roles. Inside a role you can have tasks, files, handlers and variables. But sometimes you want to use a variable across multiple roles. Unfortunately Ansible doesn’t have really a concept of global vars, but there is a trick ;-) 

You can define group variables for ALL groups, that is indeed like a global variable. I manage my Ansible code in a git repo. The file tree looks like this: 

infrastructure
  \__ group_vars
     \__ all
        \__ vars_file.yml
  \__ roles 
  \__ ansible.cfg
  \__ site.yml
  \__ hosts

 

The variables defined in “group_vars/all/vars.yml” are accessible from ALL roles! 

What is maven-compat ???

What is the maven-compat project? I was wondering. So I went to the official page of the project and found this: 

Screen Shot 2014-08-24 at 11.40.23

Maven2 classes maintained as compatibility layer.

 That is not very helpful! I would like to have a little bit more information! So clicked on the “Project Summary” link and got this. 

Screen Shot 2014-08-24 at 11.43.21

All right. Some auto generated site. Nothing I could not lookup in the pom.xml itself. And I still don’t know much more about this project. What does it do exactly? Why I need it? 

Unfortunately many Java projects are documented as bad as this one. Making an SMC public and auto generating a couple HTML pages doesn’t make it to a good Open Source project. Everytime I see something like this I get angry. Because the maintainers don’t give a shit about the community!

And by the way, JavaDocs are very poor docs! Everybody can generate JavaDocs. Why not put the project on GitHub or Bitbucket and provide a nice README with a red line, with a good intro into the project? That makes all the difference between a good and a bad open source project. 

Requirements for the perfect Crowd Software Testing Tool

The StartUp testCloud – a crowd software testing provider based in Berlin – is offering a service fro crowd software testing. 

testcloud_-logo-14

Now they are working on a new Crowd Software Testing Tool, which is completely self-service. They prepared a 3 min survey to get known your needs for the perfect Tool:  

https://www.umfrageonline.com/s/d3d0f6b

Everybody who finishes the survey can use the new tool for free up to 5 Bugs after official launch.  

I finished the survey by myself and I’m very curious to see the results.

PDFKit – invalid byte sequence in US-ASCII

I’m using PDFKit at VersionEye to generate the PDF invoices. It’s a really awesome project. The idea behind PDFKit is that you generate the documents as HTML and CSS and then convert it to PDF. That works really well. Generating a PDF works like this:

kit = PDFKit.new(html, :footer_html => footer_file, :page_size => 'A4')

The first parameter “html” is the HTML as string. In addition to that you can give a separate path to a HTML file as footer. And of course you can choose the output format. In this case DIN A4.

That worked all really well, but sometimes I got a

invalid byte sequence in US-ASCII Exception

I found out that there was some kind of special character in the HTML. That can happen if you fill the HTML template with usernames for example, and one of the users is a French dude or even worst a Chinese dude, then you have some odd characters in your markup :-) But luckily there is a solution for that. You can enforce UTF-8 encoding for the string.

This line fixed it for me.

html = html.force_encoding(Encoding::UTF_8)