Friday, October 31, 2014

HAPPY HALLOWEEN! LIMITED TIME OFFER NOW AVAILABLE!JSUTHOST WEB HOSTING $2.50 PER MONTH*

HAPPY HALLOWEEN! LIMITED TIME OFFER NOW AVAILABLE!JSUTHOST WEB HOSTING $2.50 PER MONTH*


AFFORDABLE WEB HOSTING MADE EASY


Get the last hosting account you’ll ever need today


UNLIMITED WebsitesFREE Domain IncludedUNLIMITED StorageFREE Site BuildersUNLIMITED DomainsFREE Instant SetupUNLIMITED Email AccountsFREE 24/7 Phone Support

ANYTIME

MONEY-BACK

GUARANTEE

$2.50 PER

MONTH*

INTRODUCTORY OFFER


Website Hosting


give you the following web hosting features:


Domain Name Registration

Site Builder with Templates

e-Commerce Shopping Carts

$100 Google Advertising Offer

Control Panel – Powered by cPanel

Instant Setup!

<a href=”//www.justhost.com/track/nacom/” target=”_blank”>

<img border=”0″ src=”//justhost-cdn.com/media/partner/images/nacom/430×288/jh-ppc-banners-dynamic-430×288.png”>

</a>



HAPPY HALLOWEEN! LIMITED TIME OFFER NOW AVAILABLE!JSUTHOST WEB HOSTING $2.50 PER MONTH*

Thursday, October 30, 2014

mediatemple Premium WordPress hosting for just $5.

mediatemple Premium WordPress hosting for just $5.


For two days only, promote our unbeatable web hosting at an unbelievable introductory price: $5 for the first month of Premium WordPress hosting. Just use promo code PremiumWP5 at checkout. Offer valid for the first month only.

This offer is only good for 2 days only, so hurry up, click below link:



mediatemple Premium WordPress hosting for just $5.

How To Set Up SSH Keys on Debian/Ubuntu

How To Set Up SSH Keys on Debian/Ubuntu


ssh-keygen -t rsa

You will be prompted for a location to save the keys, and a passphrase for the keys. This passphrase will protect your private key while it’s stored on the hard drive and be required to use the keys every time you need to login to a key-based system:


Generating public/private rsa key pair.

Enter file in which to save the key (/home/b/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/b/.ssh/id_rsa.

Your public key has been saved in /home/b/.ssh/id_rsa.pub.


cp id_rsa.pub authorized_keys
chmod 700 ~/.ssh
chmod 600 authorized_keys

Then edit your /etc/ssh/sshd_config to:


AuthorizedKeysFile /etc/ssh/%u/authorized_keys

Finally, restart ssh with:



service ssh restart

On the host computer, ensure that the /etc/ssh/sshd_config contains the following lines, and that they are uncommented;


PubkeyAuthentication yes

RSAAuthentication yes


if disable the PasswordAuthentication,change

PasswordAuthentication yes

to

PasswordAuthentication no



How To Set Up SSH Keys on Debian/Ubuntu

How To Install and Configure Varnish 3 with Apache on Debian

How To Install and Configure Varnish 3 with Apache on Debian


About Varnish

Varnish is an HTTP accelerator designed for content-heavy dynamic web sites as well as heavily consumed APIs. In contrast to other web accelerators, such as Squid, which began life as a client-side cache, or Apache and nginx, which are primarily origin servers, Varnish was designed as an HTTP accelerator. Varnish is focused exclusively on HTTP, unlike other proxy servers that often support FTP, SMTP and other network protocols.


Setup

Apache and Varnish


apt-get install apache2

Step One—Install Varnish


The varnish site recommends installing the varnish package through their repository.


You can start that process by grabbing the repository:


curl http://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add -

The next step is to add the repository to the list of apt sources. Go ahead and open up that file.


vim /etc/apt/sources.list

Once inside the file, add the varnish repository to the list of sources.


deb http://repo.varnish-cache.org/ubuntu/ lucid varnish-3.0

Save and exit.


Finally, update apt-get and install varnish.


apt-get update
apt-get install varnish

Step Two—Configure Varnish

Varnish will serve the content on port 80, while fetching it from apache which will run on port 8080.

vim /etc/default/varnish


DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"

Once you save and exit out of that file, open up the default.vcl file:


vim /etc/varnish/default.vcl

The configuration should like this:


backend default 
.host = "127.0.0.1";
.port = "8080";

if enbale esi


 sub vcl_fetch 
set beresp.do_esi = true; /* Do ESI processing */
set beresp.ttl = 24 h; /* Sets the TTL on the HTML above */

Step Three—Configure Apache


vim /etc/apache2/ports.conf

Change the port number for both the NameVirtualHost and the Listen line to port 8080, and the virtual host should only be accessible from the localhost. The configuration should look like this:


NameVirtualHost 127.0.0.1:8080
Listen 127.0.0.1:8080

Change these settings in the default virtual host


vim /etc/apache2/sites-available/default

<VirtualHost 127.0.0.1:8080>

Save and exit the file and proceed to restart Apache and Varnish.


service apache2 restart
service varnish restart

or manual start varnish


varnishd -f /etc/varnish/default.vcl -s malloc,128M -T 127.0.0.1:2000 -a 0.0.0.0:999 -d


How To Install and Configure Varnish 3 with Apache on Debian

Wednesday, October 22, 2014

How to uninstall gnome environment on debian

How to uninstall gnome environment on debian


aptitude purge liborbit2


How to uninstall gnome environment on debian

Grails Service Get session,response,request,servletContext

Grails Service, Get session,response,request,servletContext


import org.codehaus.groovy.grails.web.util.WebUtils
import org.springframework.web.context.request.RequestContextHolder

……

//Getting the Request object

def getRequest()
def webUtils = WebUtils.retrieveGrailsWebRequest()
webUtils.getCurrentRequest()


//Getting the Response object

def getResponse()
def webUtils = WebUtils.retrieveGrailsWebRequest()
webUtils.getCurrentResponse()


//Getting the ServletContext object

def getServletContext()
def webUtils = WebUtils.retrieveGrailsWebRequest()
webUtils.getServletContext()


//Getting the Session object

def getSession()
RequestContextHolder.currentRequestAttributes().getSession()



Grails Service Get session,response,request,servletContext

Getting Spring Context in Grails BootStrap

Getting Spring Context in Grails BootStrap


import org.springframework.web.context.support.WebApplicationContextUtils

class BootStrap

def init = servletContext ->
// Get spring
def springContext = WebApplicationContextUtils.getWebApplicationContext( servletContext )



Getting Spring Context in Grails BootStrap

Monday, October 13, 2014

Linux Command-SCP,example

Linux Command-SCP example

upload local file to remote server
scp -P 2222 /home/a5go.com.tar.gz root@a5go:/root/a5go.com.tar.gz


upload local folder to remote server
scp -P 2222 -r /home/a5go.com/ root@a5go:/root/a5go.com/


get remote server file to local
scp -P 2222 root@a5go:/root/a5go.com.tar.gz /home/a5go.com.tar.gz


get remote server folder to local
scp -P 2222 -r root@a5go:/root/a5go.com/ /home/a5go.com/



Linux Command-SCP,example

Monday, October 6, 2014

Grails Goodness Notebook

The Grails Goodness Notebook contains the blog posts about Grails. The posts are bundled and categorized into sections. Each section starts with the simpler features and ends with more advanced Grails features. The book is intended to browse through the subjects. You should be able to just open the book at a random page and learn more about Grails. Maybe pick it up once in a while and learn a bit more about known and lesser known features of Grails.


The book categorizes the posts in the following sections:


Configuration

The Command LIne

Grails Object Relational Mapping (GORM)

Validation

Controllers

Groovy Server Pages (GSP)

REST

The Service Layer

Grails and Spring

Internationalization (i18n)

IDE


Grails Goodness Notebook is updated with the following posts:

Using Bintray JCenter as Repository

Use Spring Java Configuration

Conditonally Load Beans in Java Configuration Based on Grails Environment

Using Converter Named Configurations with Default Renderers

Custom Controller Class with Resource Annotation

Change Response Formats in RestfulController

Enable Accept Header for User Agent Requests

Exception Methods in Controllers

Run Groovy Scripts in Grails Context

Using Aliases as Command Shortcuts

Generate Default .gitignore Or .hgignore File

Extending IntegrateWith Command


Visit Grails Goodness Notebook!



Grails Goodness Notebook

Saturday, October 4, 2014

Grails,How to use enum

Grails,How to use enum


Example:

Groovy Code


package com.test

public enum MessageStatus
PENDING(0),SUCCESS(1),FALSE(2)

private final Integer value

MessageStatus(Integer value)
this.value = value


Integer getId()
value


Grails Domain call this groovy method


import com.test.MessageStatus

class MessageDetails
MessageStatus status


Grails,How to use enum

Friday, October 3, 2014

Grails mail config

1. add plugin

runtime “:mail:1.0.7″

runtime “:email-confirmation:1.0.5″

2.Edit Config.groovy

gmail

grails 
 mail 
 host = "smtp.gmail.com" 
 port = 587 
 username = "a5go.com@gmail.com" 
 password = "password" 
 props = ["mail.debug": "true", 
 "mail.smtp.protocol": "smtps", 
 "mail.smtp.auth": "true", 
 "mail.smtp.starttls.enable": "true", 
 "mail.smtp.host": "smtp.gmail.com", 
 "mail.smtp.user": "a5go.com@gmail.com", 
 "mail.smtp.password": "password"] 
 

hotmail

grails 
 mail 
 host = "smtp.live.com"
 port = 587
 username = "a5go.com@live.com"
 password = "password"
 props = ["mail.smtp.starttls.enable":"true",
 "mail.smtp.port":"587"]
 


Grails mail config

Wednesday, October 1, 2014

issue:[Fatal Error] :55983:45: XML document structures must start and end within the same entity.

issue:[Fatal Error] :55983:45: XML document structures must start and end within the same entity.

status:pending


Sometimes, when running my application in development mode, I receive the following error:


Configuring Shiro ...

Configuring Shiro ...


Shiro Configured

Shiro Configured

| Server running. Browse to http://localhost:8080/bank

[Fatal Error] :55983:45: XML document structures must start and end within the same entity.


The application seems to run ok, What does this error mean?

I am running grails 2.3.7 in a JDK6,WIN7 environment.



issue:[Fatal Error] :55983:45: XML document structures must start and end within the same entity.

Getting Started with Grails and MySQL

Getting Started with Grails and MySQL

1. Create a database in MySQL.


mysql> CREATE DATABASE bank_dev;
mysql> CREATE DATABASE bank_test;
mysql> CREATE DATABASE bank_prod;

2.Add the MySQL driver to project.

Download the jar file(i am using mysql-connector-java-5.0.4-bin.jar) and put it in your $project/lib directory


3.change DataSource.groovy

The complete code should look like this


dataSource 
// pooled = true
// jmxExport = true
// driverClassName = "org.h2.Driver"
// username = "sa"
// password = ""
pooled = true
jmxExport = true
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = ""
dialect = org.hibernate.dialect.MySQL5InnoDBDialect

hibernate
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
// cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
singleSession = true // configure OSIV singleSession mode


// environment specific settings
environments
development
dataSource
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
// url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
url = "jdbc:mysql://localhost:3306/ncbank_dev?useUnicode=true&characterEncoding=UTF-8"


test
dataSource
dbCreate = "update"
// url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
url = "jdbc:mysql://localhost:3306/ncbank_test?useUnicode=true&characterEncoding=UTF-8"


production
dataSource
dbCreate = "update"
// url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
url = "jdbc:mysql://localhost:3306/ncbank_prod?useUnicode=true&characterEncoding=UTF-8"
properties
// See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors = "ConnectionState"
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED





Getting Started with Grails and MySQL

Error Error executing script ShiroQuickStart: groovy.lang.MissingMethodException: No signature of method

Error Error executing script ShiroQuickStart: groovy.lang.MissingMethodException: No signature of method


|Loading Grails 2.3.7
|Configuring classpath
> grails shiro-quick-start --prefix=com.test.
.
|Environment set to development
................................
|Packaging Grails application
.
|Uninstalled plugin [spring-security-core]
..
|Compiling 10 source files

..
|Compiling 578 source files
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
.......
|Compiling 12 source files
...............................................................................................
Configuring Shiro ...

Shiro Configured
Error |
Error executing script Shell: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uk.co.desirableobjects.oauth.scribe.OauthController': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauthService': Invocation of init method failed; nested exception is java.lang.IllegalStateException: No oauth configuration found. Please configure the oauth scribe plugin (Use --stacktrace to see the full trace)

Process finished with exit code 1

How to fix it:


grails shiro-quick-start "--prefix=com.test" --stacktrace

or


grails shiro-quick-start


Error Error executing script ShiroQuickStart: groovy.lang.MissingMethodException: No signature of method