Bastien Donjon

Développeur web à Bordeaux

Uncategorized Archive

Tuesday

2

December 2014

1

COMMENTS

Install and use Grunt in Vagrant and Windows

Written by , Posted in Uncategorized

If you have many errors with Grunt in Vagrant and Windows this is probably due to symlinks.

To fix it :

1 – Add this lines in Vagrantfile

config.vm.provider "virtualbox" do |v|
    v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
end

2 – Run this command in an admin console on Windows

fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1

3 – And start your Vagrant

vagrant up

4 – Install Grunt globally

npm install -g grunt-cli
npm install -g grunt --no-bin-links

5 – Go in your project directory and install NPM Packages without errors

npm install --no-bin-links

6 – Use Grunt

grunt --version

Wednesday

27

August 2014

0

COMMENTS

Remove duplicate documents from a search in Elasticsearch

Written by , Posted in Uncategorized

If you have many documents with the same value of the same field, this source code can help you. Using terms aggregator and top hits aggregator is required.

My index :

  • Doc 1 {domain: ‘domain1.fr’, name: ‘name1′, date: ’01-01-2014’}
  • Doc 2 {domain: ‘domain1.fr’, name: ‘name1′, date: ’01-02-2014’}
  • Doc 3 {domain: ‘domain2.fr’, name: ‘name2′, date: ’01-03-2014’}
  • Doc 4 {domain: ‘domain2.fr’, name: ‘name2′, date: ’01-04-2014’}
  • Doc 5 {domain: ‘domain3.fr’, name: ‘name3′, date: ’01-05-2014’}
  • Doc 6 {domain: ‘domain3.fr’, name: ‘name3′, date: ’01-06-2014’}

My result (deduplication result by domain field) :

  • Doc 6 {domain: ‘domain3.fr’, name: ‘name3′, date: ’01-06-2014’}
  • Doc 4 {domain: ‘domain2.fr’, name: ‘name2′, date: ’01-04-2014’}
  • Doc 2 {domain: ‘domain1.fr’, name: ‘name1′, date: ’01-02-2014’}

Elasticsearch query :

/POST http://localhost:9200/test/dedup/_search?search_type=count&pretty=true
"aggs":{
    "dedup" : {
      "terms":{
        "field": "domain"
       },
       "aggs":{
         "dedup_docs":{
           "top_hits":{
             "size":1
           }
         }
      }
    }
  }
}

I originally asked a question here.

Saturday

18

January 2014

0

COMMENTS

Download and install JAVA jdk 7 for DEBIAN 7

Written by , Posted in Uncategorized

Download jdk with command line (source) :
wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.tar.gz
Uncompress (source) :
tar -zxvf jdk-7-linux-x64.tar.gz

Move java directory “jdk1.7.0” in “/usr/java”.

Add JAVA_HOME and PATH variables :
export JAVA_HOME=/usr/java/jdk1.7.0/bin/javaexport PATH=$PATH:/usr/java/jdk1.7.0/bin