Posts

Showing posts from 2018

Get token elasticsearch

Image
GET /categories/category/1/_termvectors { "fields" : ["name"], "offsets" : true, "payloads" : true, "positions" : true, "term_statistics" : true, "field_statistics" : true } POST _search { "query" : { "term" : { "user" : "Kimchy" } } }

Build elastic search vietnamese plugin

How to build Elasticsearch Vietnamese Analysis Plugin APR 21, 2017  on  Elasticsearch Recently, I’ve received many requests to build the Vietnamese Analysis plugin when a new version of Elasticsearch is released but sometimes I’m not available to do it immediately. In case of urgent, you can build the plugin yourself with following steps. Step 1: Install Java, Maven & Git The plugin is written in Java and built with Maven, so you have to install them first. Here is the instructions for installing  Java ,  Maven  and  Git . If you are using Mac, just use these commands: brew cask install java brew install maven brew install git Step 2: Build the VnTokenizer The plugin is based on the VNTokenizer library, you have to build it before building the plugin git clone https://github.com/duydo/vn-nlp-libraries.git cd vn-nlp-libraries/nlp-parent mvn install Step 3: Build the plugin Clone the plugin’s source code: git clone https://github.com...

vietnam data json

https://github.com/madnh/hanhchinhvn

Angular-cli command

https://github.com/angular/angular-cli/blob/master/packages/angular/cli/README.md

Tool for picking color Google material

https://material.io/design/color/the-color-system.html#tools-for-picking-colors

Add SSL on IIS Self-Certification

Open PowerShell with Administrator right, change subject and DnsName you need and run # setup certificate properties including the commonName (DNSName) property for Chrome 58+ $certificate = New-SelfSignedCertificate `     -Subject abc.com `     -DnsName abc.com `     -KeyAlgorithm RSA `     -KeyLength 2048 `     -NotBefore (Get-Date) `     -NotAfter (Get-Date).AddYears(2) `     -CertStoreLocation "cert:CurrentUser\My" `     -FriendlyName "Localhost Certificate for .NET Core" `     -HashAlgorithm SHA256 `     -KeyUsage DigitalSignature, KeyEncipherment, DataEncipherment `     -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.1") $certificatePath = 'Cert:\CurrentUser\My\' + ($certificate.ThumbPrint)  # create temporary certificate path $tmpPath = "C:\tmp" If(!(test-path $tmpPath)) { New-Item -ItemType Directory -Force -Path $tmpPath } # set certificat...

Npm update window lastest version

Open Power shell with Administrator permission: Set - ExecutionPolicy Unrestricted - Scope CurrentUser - Force npm install - g npm - windows - upgrade npm - windows - upgrade

Git – Resolve Merge Conflicts

Git – Resolve Merge Conflicts Many time, when we do git push/pull or git merge, we end up with conflicts. In most cases, solution to merge-conflict is as simple as discarding local changes or remote/other branch changes. Following is useful in those cases… Resolving merge conflicts Find files with merge conflict Change working directory to project folder. cd project-folder Search for all conflicting files. grep -lr '<<<<<<<' . Above will list all files which has marker special marker  <<<<<<<  in them. Resolve easy/obvious conflicts At this point you may review each files. If solution is to accept local/our version, run: git checkout --ours PATH/FILE If solution is to accept remote/other-branch version, run: git checkout --theirs PATH/FILE If you have multiple files and you want to accept local/our version, run: grep -lr '<<<<<<<' . | xargs git checkout --ours If you have mul...

Tests not discovered in Visual Studio Test Explorer Window

Visual Studio caches the test runner adapters, and in the most of the cases a corrupted cache is the reason for this. To clean the cache, you have to do the following: 1.       Close all Visual Studio instances 2.       Go to  %TEMP%\VisualStudioTestExplorerExtensions\ 3.       Delete specrun related folders 4.       Try again

Bootstrap 4 hidden element

Update for Bootstrap 4 (2018) The  hidden-*  and  visible-*  classes  no longer exist  in Bootstrap 4. If you want to hide an element on specific tiers or breakpoints in Bootstrap 4, use the  d-*   display classes  accordingly. Remember that extra-small/mobile (formerly  xs ) is the default (implied) breakpoint, unless overridden by a  larger  breakpoint. Therefore,  the  -xs  infix no longer exists in Bootstrap 4 . Show/hide for  breakpoint and down : hidden-xs-down (hidden-xs)  =  d-none d-sm-block hidden-sm-down (hidden-sm hidden-xs)  =  d-none d-md-block hidden-md-down (hidden-md hidden-sm hidden-xs)  =  d-none d-lg-block hidden-lg-down  =  d-none d-xl-block hidden-xl-down  (n/a 3.x) =  d-none  (same as  hidden ) Show/hide for  breakpoint and up : hidden-xs-up  =  d-none  (same as  hidden ) hidden-sm-u...

JS array equivalents to C# LINQ methods

TypeScript vs. C#: LINQ TypeScript TypeScript has no equivalent for the language-integrated-natural-query aspect of LINQ. (hey, isn't that  literally  the whole acronym?) True, you  can't  write the following LINQ statement in TypeScript var adultUserNames = from u in users where u . Age >= 18 select u . Name ; However, the  IEnumerable<T>  extension methods, which are at the heart of LINQ, have equivalents in TypeScript (or can be emulated). Aggregate All Any Append Average Cast Concat Contains Count DefaultIfEmpty Distinct ElementAt ElementAtOrDefault Empty Except First FirstOrDefault List.ForEach GroupBy Intersect Last LastOrDefault Max Min OfType OrderBy / ThenBy Reverse Select SelectMany Single SingleOrDefault Skip SkipWhile Sum Take TakeWhile Union Where Zip Aggregate // C# var leftToRight = users . Aggregate ( initialValue , ( a , u ) => /* ... */ ); // TypeScrip...