rss
twitter
    Suivez-moi sur Twitter ! :)

heroku : fiche pratique

Cet article est une fiche pratique pour Heroku.

Depuis Windows

  • Pour les commandes herokudownload, je conseille d'installer et d'utiliser une console msysgit

Connexion

  • Positionner un proxy (windows) 
set http_proxy=http://myproxy:8080
  • Positionner un proxy (nux) 
set http_proxy=http://myproxy:8080
  • Pour utiliser une clé SSH : démarrer ssh-agent.exe puis utiliser ssh-add.exe
  • Pour se connecter doc
heroku login

Use "json-schema-validator" as an OSGi bundle

Hello

This post describes how to integrate json-schema-validator 2.2.5 in an OSGi container.

json-schema-validator home page redirect to the binary download site to get OSGi ready library. But with this last one I was unable to make json-schema-validator working... I got an unsatisfied package jackson-databind.

So I decide to integrate by hand json-schema-validator and related dependencies. 14 jar to get and check (see into the MANIFEST.MF the "Export-Packages" directive..)

Here is the way :

  • use json-schema-validator in your Eclipse Java project by adding the pom dependency.
  • make a sample unit test working (see example package of the json-schema-validator project).
  • open your project "pom.xml" file using eclipse to know the current dependency tree (view called "Dependency Hierarchy").

After getting one-by-one each mandatory dependendency of the json validator, here is the final list I get :
  • btf-1.2
  • jackson-annotations-2.4.1.jar
  • jackson-core-2.4.1.1.jar
  • msg-simple-1.1.jar
  • jackson-databind-2.4.1.3.jar
  • guava-16.0.1.jar
  • uri-template-0.9.jar
  • jackson-coreutils-1.8.jar
  • rhino-1.7R4.jar
  • libphonenumber-6.0.jar
  • mailapi-1.4.3.jar
  • jopt-simple-4.6.jar
  • joda-time-2.3.jar
  • json-schema-core-1.2.4.jar
  • json-schema-validator-2.2.5.jar

You can get each jar from a given maven repository; example joda-time-2.3.jar.

For each jar, I have to check the OSGi Export package directive. Here is the way to do that :

  • open the jar file using zip tool (ex. 7zip)
  • edit the file "META-INF/MANIFEST.MF"
  • check that the file contains an Export package directive like the following example for yoda time :
  • Export-Package: org.joda.time;version=2.3,org.joda.time.base;version=2
     .3,org.joda.time.chrono;version=2.3,org.joda.time.convert;version=2.3
     ,org.joda.time.field;version=2.3,org.joda.time.format;version=2.3,org
     .joda.time.tz;version=2.3
    
  • If this is not the case, add it by hand. I had to do that for the following library : rhino, libphonenumbers, joptsimple. See under the related export package :
    • rhino-1.7R4.jar
      Export-Package: org.mozilla.javascript;version="1.7"
      
    • libphonenumber-6.0.jar
      Export-Package: com.google.i18n.phonenumbers;version="6.0"
      
    • joptsimple
      Export-Package: joptsimple;version="4.6"
      
I will try to communicate to each of theses project to include this directive in the original distribution.
If you get a simple way to do the same integration, reply to this post please.

After all these steps, when I want to validate a json content with a schema, I got an error while loading meta-schema "/draftv4/schema" (problem of class loading).
Until now, I have not figured out how to fix it.

java.lang.ExceptionInInitializerError
        at com.github.fge.jsonschema.SchemaVersion.(SchemaVersion.java:65)
        at com.github.fge.jsonschema.SchemaVersion.(SchemaVersion.java:44)
        at com.github.fge.jsonschema.core.load.configuration.LoadingConfigurationBuilder.(LoadingConfigurationBuilder.java:
17)
        at com.github.fge.jsonschema.core.load.configuration.LoadingConfiguration.byDefault(LoadingConfiguration.java:151)
(...)
Caused by: java.io.IOException: resource /draftv4/schema not found
        at com.github.fge.jackson.JsonLoader.fromResource(JsonLoader.java:91)
        at com.github.fge.jsonschema.SchemaVersion.(SchemaVersion.java:63)
This file is present into "json-schema-core-1.2.4.jar" but not loaded as resource by OSGi container...

EDIT: check the last discussion from json-schema-validator issue #111

gem : fiche pratique

Cet article est une fiche pratique pour gem (alias RubyGems).

Commandes de base

  • Afficher l'environnement 
gem environment

  • Lister les gem installés 
gem list
gem q --L
gem query --local

  • installer le gem "json en version 1.4.6
gem install json -v '1.4.6'

  • Désinstaller le gem json
gem uninstall json

  • Lister les gems disponibles
gem list --remote

  • Rechercher un gem comportant "sdk"
gem search "*sdk" --remote


  • Ressources utiles : ruby-toolbox.com : recherche de gem et stats consolidées sur les gems (à partir des dépôts public et github)

  • Créer une gem : un squelette avec un ensemble de fichier par defaut
 gem install bundle
 bundle gem mongemmaison
 cat  mongemmaison/mongemmaison.gemspec
 cat  mongemmaison/bin/mongemmaison.rb