Looking To Live in France ?

Thought we would give you a preview of our home here in Brittany, western France.

If you seek the quiet life with a possible opportunity to provide local temporary accommodations, then look here: http://fabulousbrittanyhome.fr/

 

Enjot the french life-style here in Brittany, France

Wonderfully large home for your family or a football team :-D

How Gradle Makes Windows and *nix App Deploy Scripts

Thanx to Mk Yong for this idea: http://www.mkyong.com/gradle/gradle-create-a-jar-file-with-dependencies/

Assets for this post are held here: https://github.com/jnorthr/gradleMakeWindowsBat.git


 

Here is a skeleton gradle project template to build an executable java jar plus all distributable assets for a ‘HelloWorld’ java source. This is to deploy your app as a stand-alone app on a client system, something like a GUI, or batch job app – NOT a web service.

The tasks to do this are a freebie when a build.gradle file includes a plugin module named ‘application‘ courtesy of

> apply plugin:’application’

Gradle Build Tool

This project includes a full gradle build tool as a ‘wrapper’ bit inside this download. So there’s no need install gradle on your system. You can run this app once you’ve done a git clone.

Git Source Code Control

Yes, you need Git installed on your system to get started. So change into a new folder/directory on your local system and do this:

git clone https://github.com/jnorthr/gradleMakeWindowsBat.git

This makes a project directory folder named gradleMakeWindowsBat so cd into that.

You could use this approach as a foundation to create several brand-new projects. Sure you would need to change gradleMakeWindowsBat to something else and the main class names would change too, but a lot of the setup work is done for you here.

Build / Check

Now you can just run the gradle wrapper like so:

> gradlew check

or

> bash ./gradlew check

This will ask gradle to download any dependency bits it needs to make it happy, and check that everything is cool on your installed version.

Build

Ok, to make it all happen, run gradlew again without options.

> gradlew

or

> bash ./gradlew

The default tasks are run. These are:

defaultTasks ‘clean’, ‘build’, ‘javadoc’, ‘installApp’, ‘startScripts’, ‘fatJar’, ‘distTar’, ‘distZip’, ‘run’

Tasks to Deploy An App

- clean – gradle cleans the environment before starting

build – when javac – compiles the HelloWorld module

- javadoc – the javadoc API document is created with any source code comments

installApp makes a folder named install and a sub-folder of gradleMakeWindowsBat containing /bin, /docs, /lib folders with all the pieces to do a full install on a client system. Ship the gradleMakeWindowsBat folder and change the client’s OS path variable to include gradleMakeWindowsBat/bin then on the command line you/they can run this job by typing the name of this  batch script file as gradleMakeWindowsBat  – easy-peasy !

- startScripts – makes a folder of identical windoze and unix batch script files. These scripts will run the core job noted in the build.gradle file as

mainClassName = "com.jnorthr.DateUtils"

- yeah, you can change that for your own needs. Be sure to add the .jar files in build/libs to the system CLASSPATH variable.

- fatJar – my favorite ! makes an executable jar file of the java/groovy/scala/jvm language classes and bits. You can just double click on the gradleMakeWindowsBat-all-1.0.jar file to run your app.

Alternatively from a command line with the jar in the same folder, you can do this:

> java -jar gradleMakeWindowsBat-all-1.0.jar

Everything needed has been included in this ‘fat’ jar !


Tasks to Transfer The Project Build Environment

When we need to move/copy/transfer a complete project that includes all the development tools, build stuff and source code controls, we can use either of these two tasks depending on the target computer system’s OS:

- distTar packages up the full folder directory and makes it ready for shipment to a target computer system running Unix/Linux/Ubuntu etc.

distZip packages up the full project folder directory in a compressed archive format. This is useful as a general-purpose tool to move a complete project around to target computer systems where the OS is unconventional like, say, Windows, IBM, DEC.

Both tasks run as a default set of tasks. Project build times may seem excessive as so many solutions are being produced. To speed things up you could alter the build.gradle file to remove these two tasks if you do not plan to move the project to another system.

Task to Run This App

- the run task starts execution of an app. The app name is declared in the build.gradle file as

> mainClassName = "com.jnorthr.DateUtils"

change to suit your own requirements.

recovery sessoin on ubuntu 14.04

(L)Ubuntu 14.04 Quick Un-Erase / Un-Delete Tip

An open source utility that i had installed on my Lubuntu 14.04 system, decided to blitz several of my precious folders. I can look into the ‘Trash‘ folder and see them all there, but the installed system utilities would not let me open them or copy them out. How to do that ? Well googled for a while to find there were a bunch of open source linux tools to help un-delete / un-erase deleted file partitions, and disks etc. 

Well, ok that’s useful, but what about if we just have a few precious files that ended up in Trash by mistake ? How do we get those back ? After reading this: Location of Trash onUbuntu 14.04 well that gave me the location of where ubuntu stores the trash. So had to open a terminal session to get to the command line. Then it all became rather simple.

 The first time i ran this i needed to include the ‘sudo’ prefix to make ubuntu happy enough to let me into this trash folder. Then on my system, my trash is held in my home folder so i changed directories to it here:

sudo cd ~/.local/share/Trash/files/.trash 

then i could use 

ls -al

to see all the stuff in the trash. Ok, it’s there but how do i get it back to my side ? Well simple enough, we have the move command named ‘mv’ and that was the trick. I first tried to move a file as i did NOT want to try moving a valuable directory just in case it all went wrong. So in the trash folder tried this:

~/.local/share/Trash/files/.trash mv DSL.adoc ~/Desktop

press the enter key and voila! My precious DSL.adoc file is moved back onto my ubuntu Desktop. I opened it with a text editor just to confirm it was all there – and it was !!!!

Folders Too ?

So did that for each file i wanted to restore, but what about folder directories ? Could those be retrieved ? Well, tried a non-valuable folder with the MV command and again success !!!

Then did moves for each of my precious folder to get them back to my desktop. Here is screenshot of some of this session: 

recovery sessoin on ubuntu 14.04

 

Have not checked permissions or ownership bits but am not fussed, as i have my valuable data back again – no big tools, utilities, etc. just knowing where the trash is on your system, the ability to change directories into that location and use of the mv command.

Note that your trash may be located at a slightly different address so you may need to hunt a little to find it. But i’ll bet your files might still be there waiting for you if you just know where !

Hope this helps you – give this post a LIKE if it does ! Happy recovery !!!

 

Screenshot 2014-08-13 23.45.21

IETF – Internet Engineering Task Force Documents

 


Screenshot 2014-08-13 23.45.21

Internet Engineering Task Force Docs

Completely forgot this was written several years ago to access all the IETF documents. It was Oct. 2012, and the tons of IETF documents were/are online for public consumption.

This app runs on Google App Engine  and has been running for several years. It stills has daily hits so if you need to review or research features and engineering documents about how th einternet came into being, then look here: http://ietf-document-index.appspot.com

Cloud Foundry Performance Testing

Have been wondering for sometime how we can measure the overall response of a known Cloud Foundry PaaS target. What kind of metrics can we use ?

As a first attempt, let’s review the PAT tool as reviewed by Dr. Nic. Look here: https://blog.starkandwayne.com/2014/08/02/ask-pat-how-long-does-it-take-to-push-apps/

and if you are really keen, you can hack your own version of PAT from the Github repo here: https://github.com/cloudfoundry-incubator/pat

My ideas involved a test harness to hit several/many CF targets simultaneously and let it all run for a few days. This would give a larger overview across a wider time span. We could see the highs and lows using some metrics – which times of day are bad/good – which days of the week are good ?  Do background tasks on the target CF influence or results ? Are they doing backups while we push our app to them ?

Maybe another test harness to bang our app on each CF target every n seconds/minutes/days ?

Then we could publish those metrics so we all have a better of of which PaaS is rubbish like CloudBees and which ones are sterling like IBM BlueMix and Anynines.com :-)

 

 

cropped-xperimental5h.png

Asciidoctor Admonition Icons Missing

Been writing some reference documents in my new ‘best friend’ – the asciidoctor markup syntax. For some time now i get puzzled when i want an admonition icon to appear in my document but it won’t. Ok my markup looks good to me and i have installed the ruby asciidoctor version:

jnorthr@jnorthr-EC548AA-ABU-a1128-uk:~/Desktop$ asciidoctor -V
Asciidoctor 0.1.4 [http://asciidoctor.org]

So a typical document like this works fine except that the beautiful image icons do not show up. I thought at first i had to lug around a folder of ./images/icon/*.png and all that stuff but it irked me somewhat.

My text of

= Notes About Asciidoc Sample Applications
jnorthr <jim.northrop@orange.fr>
v1.0, 2014-06-01 updated 7 June 2014

:icons: font

NOTE: Asciidoctor now supports font-based admonition icons, powered by Font Awesome!

== Overview

Caelyf lacks a template servlet for markup documents written using the asciidoctor markup syntax.

== Sample Application

You can find most of our sample applications on our github anynines account at https://github.com/anynines/[https://github.com/anynines/]. 

WARNING: You will need to signup with a cloud foundry PaaS provider before running any of these samples.

looks ok and renders as html quite nicely.


sample1


 

So that’s not what i need is it ? Where are my awesome icons ? Well, it turns out that i needed to add a bit of code to pull down the awesome.css stylesheet that has all the magic. So on the line just above


:icons: font

I added a passthru comment that renders in the final html document. That passthru comment looks like:

 

v1.0, 2014-06-01 updated 7 June 2014

++++
<link rel="stylesheet"  href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.1.0/css/font-awesome.min.css">
++++

:icons: font

So we need an external css link specification between the document date line and the icons font line. See my <LINK code above, and yes you do need to include ++++ lines above and below it too.

If you put that line into your .adoc script, so should experience the joy and pleasure of visible awesome fonts for all asciidoctor admonitions !   :)

sample3

 


Gradle Properties in Cloud Foundry Closure

See notes here: https://github.com/cloudfoundry/cf-java-client/blob/master/cloudfoundry-gradle-plugin/README.md

1. according to gradle documentation, we can put our PaaS cloud foundry target credentials into

~/.gradle/gradle.properties

like this:

cf.username=’men@work.com’

with single quotes. If we do that, we get this result:

:template-project:cf-login
 Authenticating to 'https://api.run.pivotal.io' with username ''men@work.com''
 POST request for "https://login.run.pivotal.io/oauth/token" resulted in 401 (Unauthorized); invoking error handler
 :template-project:cf-login FAILED

FAILURE: Build failed with an exception.

but removing the single quotes makes it work.

NOTE: Gripe !! the credentials in gradle.properties take precedence over those declared in our gradle script closure !!! So if we deploy the same app to several different PaaS targets we can not declare credentials in gradle.properties we just need a build.gradle script for each PaaS target  :-P

2. plugin cf-push where there is already an existing service leaves orphan services that were originally attached. Is this because of the “rediscloud-${randomWord}” random word declaration in the cloud foundry closure ?
3. same as 2. but also looses the uri as there is no/or a faulty rebind of uri to our app

 

4. cf-push of new app that does not already exist appears to work, correctly builds services and binds the uri correctly.

 

5. also note that ~/.gradle/gradle.properties needs a password too, so:

cf.password=porkypig