Lets share love

How ? copy url of this blog and share in your social network :) simple

Lets share love

How ? copy url of this blog and share in your social network :) simple

Tuesday, April 21, 2015

Gradle and Spring Boot

What is Gradle : 

Gradle is a project automation tool that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL) instead of the more traditional XML form of declaring the project configuration.

First of all, Gradle is a dependency programming tool which also means it's a programming tool. With Gradle you can execute any random task in your setup and Gradle will make sure all declared dependecies are properly and timely executed. Your code can be spread across many directories in any kind of layout (tree, flat, scattered, ...).

Gradle was designed for multi-project builds which can grow to be quite large, and supports incremental builds by intelligently determining which parts of the build tree are up-to-date, so that any task dependent upon those parts will not need to be re-executed.

And what is Spring Boot : 
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.

Features

  • Create stand-alone Spring applications
  • Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
  • Provide opinionated 'starter' POMs to simplify your Maven configuration
  • Automatically configure Spring whenever possible
  • Provide production-ready features such as metrics, health checks and externalized configuration
  • Absolutely no code generation and no requirement for XML configuration

Using spring boot with gradle 

Gradle users can directly import “starter POMs” in their dependencies section. Unlike Maven, there is no “super parent” to import to share some configuration.
apply plugin: 'java'

repositories { jcenter() }
dependencies {
    compile("org.springframework.boot:spring-boot-starter-web:1.3.0.BUILD-SNAPSHOT")
}
The spring-boot-gradle-plugin is also available and provides tasks to create executable jars and run projects from source. It also provides dependency management that, among other capabilities, allows you to omit the version number for any dependencies that are managed by Spring Boot:
buildscript {
    repositories { jcenter() }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.0.BUILD-SNAPSHOT")
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot.spring-boot'

repositories { jcenter() }
dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile("org.springframework.boot:spring-boot-starter-test")
}

Wednesday, April 15, 2015

how to search whole project in intellij ?

shift + ctrl + f 


Monday, April 6, 2015

.htaccess file for your web application grails application

Write following code in a text file and save with name .htaccess . In case of grails app put it in root folder.


RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^128\.199\.254\.7$
RewriteRule ^(.*)$ http://www.yourDomain.com/$1 [L,R=301]

Friday, April 3, 2015

Error in intellij after sudden shutdown of laptop in grails/other project

I have battery problem and sometimes laptop goes off suddenly. And due to this while working i got problem in intellij while working in grails project. I did all sort of things like updating grails SDK , checking JDK and many more. The solution is so simple. 

go to intellij > file > 

then click on Invalidate and restart. and you are done. 

And if you want to delete cache without opening intellij go to 
                         home/.IntelliJIdeaXX/system 
and delete cache

here is the link to jetbrains page for cleaning system cache.

Monday, March 30, 2015

How to use JODA time lib in Grails Application

first go to

https://github.com/JodaOrg/joda-time/releases

download latest version of joda tile lib and put it in "lib" folder of grails app

then import

import org.joda.time.DateTime;
import org.joda.time.Days;
import java.util.Date;

then here is a exmple to find difference between dates.

                   Date future = job.applyBefore;
        Date today = new Date();

        int Days = Days.daysBetween(new DateTime(today), new                 DateTime(future)).getDays();


you have used joda time lib :) 

Saturday, March 28, 2015

districts of nepal

S.N.ZoneDistrictsHeadquarter
1MechiTaplejungTaplejung
2PanchtharPhidim
3IlamIlam
4JhapaChandragadi
5KoshiMorangBiratnagar
6SunsariInaruwa
7DhankuttaDhankutta
8SankhuwasabhaKhandbari
9BhojpurBhojpur
10TerhathumTerhathum
11SagarmathaOkhaldungaOkhaldunga
12KhotangDiktel
13SolukhumbuSolusalleri
14UdaypurGaighat
15SaptariRajbiraj
16SirahaSiraha
17JanakpurDhanusaJanakpur
18MahottariJaleswor
19SarlahiMalangwa
20SindhuliSindhuligadi
21RamechhapManthali
22DolkhaCharikot
23BagmatiSindhupalchaukChautara
24KavreplanchaukDhulikhel
25LalitpurLalitpur
26BhaktapurBhaktapur
27KathmanduKathmandu
28NuwakotBidur
29RasuwaDhunche
30DhadingDhadingbeshi
31NarayaniMakwanpurHetauda
32RauthatGaur
33BaraKalaiya
34ParsaBirgunj
35ChitwanBharatpur
36GandakiGorkhaGorkha
37LamjungBeshisahar
38TanahunDamauli
39SyangjaPutalikhel
40KaskiPokhara
41ManagChame
42DhawalagiriMustangJomsom
43ParwatKusma
44MyagdiBaini
45BaglungBaglung
46LumbiniGulmiTamghas
47PalpaTansen
48NawalparasiParasi
49RupandehiBhairawa
50ArghakhanchiSandhikarka
51KapilvastuTaulihawa
52RaptiPyuthanPyuthan
53RolpaLibang
54RukumMuskikot
55SalyanSalyan
56DangGhorahi
57BheriBardiyaGulriya
58SurkhetBirendranagar
59Dailekh
60BankeNepalgunj
61JajarkotJajarkot
62KarnaliDolpaDunai
63HumlaSimikot
64KalikotManma
65MuguGamgadi
66JumlaJumla
67SetiBajuraMartadi
68BajhangChainpur
69AchhamMangalsen
70DotiSilgadi
71KailaliDhangadi
72MahakaliKanchanpurMahendranagar
73DadeldhuraDadeldhura
74BaitadiBaitadi
75DarchulaDarchula